/*
 * GoJS v2.2.7 JavaScript Library for HTML Diagrams, https://gojs.net
 * GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation, https://www.nwoods.com.
 * Copyright (C) 1998-2022 by Northwoods Software Corporation.  All Rights Reserved.
 * THIS SOFTWARE IS LICENSED.  THE LICENSE AGREEMENT IS AT: https://gojs.net/2.2.7/license.html.
 * DO NOT MODIFY THIS FILE.  DO NOT DISTRIBUTE A MODIFIED COPY OF THE CONTENTS OF THIS FILE.
 */
(function() { var t;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function ca(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:aa(a)}}function ea(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c}var fa="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b},ha;
if("function"==typeof Object.setPrototypeOf)ha=Object.setPrototypeOf;else{var ia;a:{var ja={a:!0},ka={};try{ka.__proto__=ja;ia=ka.a;break a}catch(a){}ia=!1}ha=ia?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var la=ha;
function ma(a,b){a.prototype=fa(b.prototype);a.prototype.constructor=a;if(la)la(a,b);else for(var c in b)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.oB=b.prototype}
var na="undefined"!=typeof global&&null!=global?global:self,oa="function"==typeof Object.assign?Object.assign:function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(d)for(var e in d)Object.prototype.hasOwnProperty.call(d,e)&&(a[e]=d[e])}return a},qa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};
function ra(a,b){if(b){var c=na;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&qa(c,a,{writable:!0,value:b})}}ra("Object.assign",function(a){return a||oa});ra("Array.prototype.fill",function(a){return a?a:function(a,c,d){var b=this.length||0;0>c&&(c=Math.max(0,b+c));if(null==d||d>b)d=b;d=Number(d);0>d&&(d=Math.max(0,b+d));for(c=Number(c||0);c<d;c++)this[c]=a;return this}});var x="object"===typeof globalThis&&globalThis||"object"===typeof global&&global.global===global&&global||"object"===typeof self&&self.self===self&&self||{};void 0===x.requestAnimationFrame&&(void 0===x.setImmediate?x.requestAnimationFrame=function(a){x.setTimeout(a,0)}:x.requestAnimationFrame=x.setImmediate);function sa(){}function ta(a,b){var c=-1;return function(){var d=this,e=arguments;-1!==c&&x.clearTimeout(c);c=ua(function(){c=-1;a.apply(d,e)},b)}}function ua(a,b){return x.setTimeout(a,b)}
function va(a){return x.document.createElement(a)}function C(a){throw Error(a);}function wa(a,b){a="The object is frozen, so its properties cannot be set: "+a.toString();void 0!==b&&(a+="  to value: "+b);C(a)}function xa(a,b,c,d){c=null===c?"*":"string"===typeof c?c:"function"===typeof c&&"string"===typeof c.className?c.className:"";void 0!==d&&(c+="."+d);C(c+" is not in the range "+b+": "+a)}function ya(a){x.console&&x.console.log(a)}function za(a){return"object"===typeof a&&null!==a}
function Aa(a){return Array.isArray(a)||x.NodeList&&a instanceof x.NodeList||x.HTMLCollection&&a instanceof x.HTMLCollection}function Ba(a){return Array.prototype.slice.call(a)}function Ea(a,b,c){Array.isArray(a)?b>=a.length?a.push(c):a.splice(b,0,c):C("Cannot insert an object into an HTMLCollection or NodeList: "+c+" at "+b)}function Fa(a,b){Array.isArray(a)?b>=a.length?a.pop():a.splice(b,1):C("Cannot remove an object from an HTMLCollection or NodeList at "+b)}
function Ga(){var a=Ha.pop();return void 0===a?[]:a}function Ja(a){a.length=0;Ha.push(a)}function Ka(a){if("function"===typeof a){if(a.className)return a.className;if(a.name)return a.name;var b=a.toString();b=b.substring(9,b.indexOf("(")).trim();if(""!==b)return a._className=b}else if(za(a)&&a.constructor)return Ka(a.constructor);return typeof a}
function La(a){var b=a;za(a)&&(a.text?b=a.text:a.name?b=a.name:void 0!==a.key?b=a.key:void 0!==a.id?b=a.id:a.constructor===Object&&(a.Text?b=a.Text:a.Name?b=a.Name:void 0!==a.Key?b=a.Key:void 0!==a.Id?b=a.Id:void 0!==a.ID&&(b=a.ID)));return void 0===b?"undefined":null===b?"null":b.toString()}function Ma(a,b){if(a.hasOwnProperty(b))return!0;for(a=Object.getPrototypeOf(a);a&&a!==Function;){if(a.hasOwnProperty(b))return!0;var c=a.aB;if(c&&c[b])return!0;a=Object.getPrototypeOf(a)}return!1}
function Na(a,b,c){Object.defineProperty(Pa.prototype,a,{get:b,set:c})}
function Qa(a){for(var b=[],c=0;256>c;c++)b["0123456789abcdef".charAt(c>>4)+"0123456789abcdef".charAt(c&15)]=String.fromCharCode(c);a.length%2&&(a="0"+a);c=[];for(var d=0,e=0;e<a.length;e+=2)c[d++]=b[a.substr(e,2)];a=c.join("");a=""===a?"0":a;b=[];for(c=0;256>c;c++)b[c]=c;for(c=d=0;256>c;c++)d=(d+b[c]+119)%256,e=b[c],b[c]=b[d],b[d]=e;d=c=0;for(var f="",g=0;g<a.length;g++)c=(c+1)%256,d=(d+b[c])%256,e=b[c],b[c]=b[d],b[d]=e,f+=String.fromCharCode(a.charCodeAt(g)^b[(b[c]+b[d])%256]);return f}
var Ra=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("Trident/7"),Sa=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("Edge/"),Ta=void 0!==x.navigator&&void 0!==x.navigator.platform&&null!==x.navigator.platform.match(/(iPhone|iPod|iPad|Mac)/i),Ha=[];Object.freeze([]);sa.className="Util";sa.Dx="32ab5ff3b26f42dc0ed90f21462913b5";sa.adym="gojs.net";sa.vfo="28e644fdb4";sa.className="Util";function D(a,b,c){Ua(this);this.j=a;this.na=b;this.o=c}
D.prototype.toString=function(){return"EnumValue."+this.na};function Va(a,b){return void 0===b||null===b||""===b?null:a[b]}na.Object.defineProperties(D.prototype,{classType:{get:function(){return this.j}},name:{get:function(){return this.na}},value:{get:function(){return this.o}}});D.className="EnumValue";function Wa(){this.Dw=[]}Wa.prototype.toString=function(){return this.Dw.join("")};
Wa.prototype.add=function(a){""!==a&&this.Dw.push(a)};Wa.className="StringBuilder";function Xa(){}Xa.className="PropertyCollection";
var Ya={cB:!1,hB:!1,eB:!1,gB:!1,mB:!1,kB:!1,Kx:!1,dB:null,trace:function(a){x.console&&x.console.log(a)},fB:function(a,b,c,d){a.strokeStyle="red";a.fillStyle="red";a.font="8px sans-serif";a.beginPath();a.moveTo(-10,0);a.lineTo(10,0);a.moveTo(0,-10);a.lineTo(0,10);a.stroke();a.setTransform(1,0,0,1,0,0);a.scale(c,c);a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy);a.lineWidth=2;a.beginPath();a.moveTo(d.left,d.top+20);a.lineTo(d.left,d.top);a.lineTo(d.left+20,d.top);a.moveTo(d.right,d.bottom-20);a.lineTo(d.right,
d.bottom);a.lineTo(d.right-20,d.bottom);a.stroke();a.fillText("DB: "+Math.round(d.x)+", "+Math.round(d.y)+", "+Math.round(d.width)+", "+Math.round(d.height),d.left,d.top-5)},bB:function(a){var b={},c;for(c in a){b.x=c;if("licenseKey"!==b.x){var d=a[b.x];if(void 0!==d.prototype){b.im=Object.getOwnPropertyNames(d.prototype);for(var e={$j:0};e.$j<b.im.length;e={$j:e.$j},e.$j++){var f=Object.getOwnPropertyDescriptor(d.prototype,b.im[e.$j]);void 0!==f.get&&void 0===f.set&&Object.defineProperty(d.prototype,
b.im[e.$j],{set:function(a,b){return function(){throw Error("Property "+a.im[b.$j]+" of "+a.x+" is read-only.");}}(b,e)})}}}b={im:b.im,x:b.x}}}};function Za(){}Za.prototype.reset=function(){};Za.prototype.next=function(){return!1};Za.prototype.rd=function(){return!1};Za.prototype.first=function(){return null};Za.prototype.any=function(){return!1};Za.prototype.all=function(){return!0};Za.prototype.each=function(){return this};Za.prototype.map=function(){return this};Za.prototype.filter=function(){return this};
Za.prototype.Td=function(){};Za.prototype.toString=function(){return"EmptyIterator"};na.Object.defineProperties(Za.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 0}}});Za.prototype.first=Za.prototype.first;Za.prototype.hasNext=Za.prototype.rd;Za.prototype.next=Za.prototype.next;Za.prototype.reset=Za.prototype.reset;var $a=null;Za.className="EmptyIterator";$a=new Za;function ab(a){this.key=-1;this.value=a}
ab.prototype.reset=function(){this.key=-1};ab.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};ab.prototype.rd=function(){return this.next()};ab.prototype.first=function(){this.key=0;return this.value};ab.prototype.any=function(a){this.key=-1;return a(this.value)};ab.prototype.all=function(a){this.key=-1;return a(this.value)};ab.prototype.each=function(a){this.key=-1;a(this.value);return this};ab.prototype.map=function(a){return new ab(a(this.value))};
ab.prototype.filter=function(a){return a(this.value)?new ab(this.value):$a};ab.prototype.Td=function(){this.value=null};ab.prototype.toString=function(){return"SingletonIterator("+this.value+")"};na.Object.defineProperties(ab.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 1}}});ab.prototype.first=ab.prototype.first;ab.prototype.hasNext=ab.prototype.rd;ab.prototype.next=ab.prototype.next;
ab.prototype.reset=ab.prototype.reset;ab.className="SingletonIterator";function bb(a){this.rb=a;this.ef=null;a.Ja=null;this.ia=a.Da;this.Ra=-1}bb.prototype.reset=function(){var a=this.rb;a.Ja=null;this.ia=a.Da;this.Ra=-1};bb.prototype.next=function(){var a=this.rb;if(a.Da!==this.ia&&0>this.key)return!1;a=a.m;var b=a.length,c=++this.Ra,d=this.ef;if(null!==d)for(;c<b;){var e=a[c];if(d(e))return this.key=this.Ra=c,this.value=e,!0;c++}else{if(c<b)return this.key=c,this.value=a[c],!0;this.Td()}return!1};
bb.prototype.rd=function(){return this.next()};bb.prototype.first=function(){var a=this.rb;this.ia=a.Da;this.Ra=0;a=a.m;var b=a.length,c=this.ef;if(null!==c){for(var d=0;d<b;){var e=a[d];if(c(e))return this.key=this.Ra=d,this.value=e;d++}return null}return 0<b?(a=a[0],this.key=0,this.value=a):null};bb.prototype.any=function(a){var b=this.rb;b.Ja=null;this.Ra=-1;b=b.m;for(var c=b.length,d=this.ef,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&a(f))return!0}return!1};
bb.prototype.all=function(a){var b=this.rb;b.Ja=null;this.Ra=-1;b=b.m;for(var c=b.length,d=this.ef,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&!a(f))return!1}return!0};bb.prototype.each=function(a){var b=this.rb;b.Ja=null;this.Ra=-1;b=b.m;for(var c=b.length,d=this.ef,e=0;e<c;e++){var f=b[e];(null===d||d(f))&&a(f)}return this};
bb.prototype.map=function(a){var b=this.rb;b.Ja=null;this.Ra=-1;var c=[];b=b.m;for(var d=b.length,e=this.ef,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&c.push(a(g))}a=new F;a.m=c;a.lb();return a.iterator};bb.prototype.filter=function(a){var b=this.rb;b.Ja=null;this.Ra=-1;var c=[];b=b.m;for(var d=b.length,e=this.ef,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&a(g)&&c.push(g)}a=new F;a.m=c;a.lb();return a.iterator};
bb.prototype.Td=function(){this.key=-1;this.value=null;this.ia=-1;this.ef=null;this.rb.Ja=this};bb.prototype.toString=function(){return"ListIterator@"+this.Ra+"/"+this.rb.count};
na.Object.defineProperties(bb.prototype,{iterator:{get:function(){return this}},predicate:{get:function(){return this.ef},set:function(a){this.ef=a}},count:{get:function(){var a=this.ef;if(null!==a){for(var b=0,c=this.rb.m,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.rb.m.length}}});bb.prototype.first=bb.prototype.first;bb.prototype.hasNext=bb.prototype.rd;bb.prototype.next=bb.prototype.next;
bb.prototype.reset=bb.prototype.reset;bb.className="ListIterator";function eb(a){this.rb=a;a.Sg=null;this.ia=a.Da;this.Ra=a.m.length}eb.prototype.reset=function(){var a=this.rb;a.Sg=null;this.ia=a.Da;this.Ra=a.m.length};eb.prototype.next=function(){var a=this.rb;if(a.Da!==this.ia&&0>this.key)return!1;var b=--this.Ra;if(0<=b)return this.key=b,this.value=a.m[b],!0;this.Td();return!1};eb.prototype.rd=function(){return this.next()};
eb.prototype.first=function(){var a=this.rb;this.ia=a.Da;var b=a.m;this.Ra=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};eb.prototype.any=function(a){var b=this.rb;b.Sg=null;b=b.m;var c=b.length;this.Ra=c;for(--c;0<=c;c--)if(a(b[c]))return!0;return!1};eb.prototype.all=function(a){var b=this.rb;b.Sg=null;b=b.m;var c=b.length;this.Ra=c;for(--c;0<=c;c--)if(!a(b[c]))return!1;return!0};
eb.prototype.each=function(a){var b=this.rb;b.Sg=null;b=b.m;var c=b.length;this.Ra=c;for(--c;0<=c;c--)a(b[c]);return this};eb.prototype.map=function(a){var b=this.rb;b.Sg=null;var c=[];b=b.m;var d=b.length;this.Ra=d;for(--d;0<=d;d--)c.push(a(b[d]));a=new F;a.m=c;a.lb();return a.iterator};eb.prototype.filter=function(a){var b=this.rb;b.Sg=null;var c=[];b=b.m;var d=b.length;this.Ra=d;for(--d;0<=d;d--){var e=b[d];a(e)&&c.push(e)}a=new F;a.m=c;a.lb();return a.iterator};
eb.prototype.Td=function(){this.key=-1;this.value=null;this.ia=-1;this.rb.Sg=this};eb.prototype.toString=function(){return"ListIteratorBackwards("+this.Ra+"/"+this.rb.count+")"};na.Object.defineProperties(eb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.rb.m.length}}});eb.prototype.first=eb.prototype.first;eb.prototype.hasNext=eb.prototype.rd;eb.prototype.next=eb.prototype.next;eb.prototype.reset=eb.prototype.reset;
eb.className="ListIteratorBackwards";function F(a){Ua(this);this.v=!1;this.m=[];this.Da=0;this.Sg=this.Ja=null;"string"===typeof a&&C("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type.");void 0!==a&&this.addAll(a)}t=F.prototype;t.lb=function(){var a=this.Da;a++;999999999<a&&(a=0);this.Da=a};t.freeze=function(){this.v=!0;return this};t.ea=function(){this.v=!1;return this};t.toString=function(){return"List()#"+fb(this)};
t.add=function(a){if(null===a)return this;this.v&&wa(this,a);this.m.push(a);this.lb();return this};t.push=function(a){this.add(a)};t.addAll=function(a){if(null===a)return this;this.v&&wa(this);var b=this.m;if(Aa(a))for(var c=a.length,d=0;d<c;d++)b.push(a[d]);else for(a=a.iterator;a.next();)b.push(a.value);this.lb();return this};t.clear=function(){this.v&&wa(this);this.m.length=0;this.lb()};t.contains=function(a){return null===a?!1:-1!==this.m.indexOf(a)};t.has=function(a){return this.contains(a)};
t.indexOf=function(a){return null===a?-1:this.m.indexOf(a)};t.J=function(a){var b=this.m;(0>a||a>=b.length)&&xa(a,"0 <= i < length",F,"elt:i");return b[a]};t.get=function(a){return this.J(a)};t.Pc=function(a,b){var c=this.m;(0>a||a>=c.length)&&xa(a,"0 <= i < length",F,"setElt:i");this.v&&wa(this,a);c[a]=b};t.set=function(a,b){this.Pc(a,b)};t.first=function(){var a=this.m;return 0===a.length?null:a[0]};t.$b=function(){var a=this.m,b=a.length;return 0<b?a[b-1]:null};
t.pop=function(){this.v&&wa(this);var a=this.m;return 0<a.length?a.pop():null};F.prototype.any=function(a){for(var b=this.m,c=b.length,d=0;d<c;d++)if(a(b[d]))return!0;return!1};F.prototype.all=function(a){for(var b=this.m,c=b.length,d=0;d<c;d++)if(!a(b[d]))return!1;return!0};F.prototype.each=function(a){for(var b=this.m,c=b.length,d=0;d<c;d++)a(b[d]);return this};F.prototype.map=function(a){for(var b=new F,c=[],d=this.m,e=d.length,f=0;f<e;f++)c.push(a(d[f]));b.m=c;b.lb();return b};
F.prototype.filter=function(a){for(var b=new F,c=[],d=this.m,e=d.length,f=0;f<e;f++){var g=d[f];a(g)&&c.push(g)}b.m=c;b.lb();return b};t=F.prototype;t.wb=function(a,b){0>a&&xa(a,">= 0",F,"insertAt:i");this.v&&wa(this,a);var c=this.m;a>=c.length?c.push(b):c.splice(a,0,b);this.lb()};t.remove=function(a){if(null===a)return!1;this.v&&wa(this,a);var b=this.m;a=b.indexOf(a);if(-1===a)return!1;a===b.length-1?b.pop():b.splice(a,1);this.lb();return!0};t.delete=function(a){return this.remove(a)};
t.eb=function(a){var b=this.m;(0>a||a>=b.length)&&xa(a,"0 <= i < length",F,"removeAt:i");this.v&&wa(this,a);a===b.length-1?b.pop():b.splice(a,1);this.lb()};t.removeRange=function(a,b){var c=this.m,d=c.length;if(0>a)a=0;else if(a>=d)return this;if(0>b)return this;b>=d&&(b=d-1);if(a>b)return this;this.v&&wa(this);for(var e=a,f=b+1;f<d;)c[e++]=c[f++];c.length=d-(b-a+1);this.lb();return this};F.prototype.copy=function(){var a=new F,b=this.m;0<b.length&&(a.m=Array.prototype.slice.call(b));return a};
t=F.prototype;t.ya=function(){for(var a=this.m,b=this.count,c=Array(b),d=0;d<b;d++)c[d]=a[d];return c};t.Qv=function(){for(var a=new G,b=this.m,c=this.count,d=0;d<c;d++)a.add(b[d]);return a};t.sort=function(a){this.v&&wa(this);this.m.sort(a);this.lb();return this};
t.Vi=function(a,b,c){var d=this.m,e=d.length;void 0===b&&(b=0);void 0===c&&(c=e);this.v&&wa(this);var f=c-b;if(1>=f)return this;(0>b||b>=e-1)&&xa(b,"0 <= from < length",F,"sortRange:from");if(2===f)return c=d[b],e=d[b+1],0<a(c,e)&&(d[b]=e,d[b+1]=c,this.lb()),this;if(0===b)if(c>=e)d.sort(a);else for(b=d.slice(0,c),b.sort(a),a=0;a<c;a++)d[a]=b[a];else if(c>=e)for(c=d.slice(b),c.sort(a),a=b;a<e;a++)d[a]=c[a-b];else for(e=d.slice(b,c),e.sort(a),a=b;a<c;a++)d[a]=e[a-b];this.lb();return this};
t.reverse=function(){this.v&&wa(this);this.m.reverse();this.lb();return this};
na.Object.defineProperties(F.prototype,{_dataArray:{get:function(){return this.m}},count:{get:function(){return this.m.length}},size:{get:function(){return this.m.length}},length:{get:function(){return this.m.length}},iterator:{get:function(){if(0>=this.m.length)return $a;var a=this.Ja;return null!==a?(a.reset(),a):new bb(this)}},iteratorBackwards:{
get:function(){if(0>=this.m.length)return $a;var a=this.Sg;return null!==a?(a.reset(),a):new eb(this)}}});F.prototype.reverse=F.prototype.reverse;F.prototype.sortRange=F.prototype.Vi;F.prototype.sort=F.prototype.sort;F.prototype.toSet=F.prototype.Qv;F.prototype.toArray=F.prototype.ya;F.prototype.removeRange=F.prototype.removeRange;F.prototype.removeAt=F.prototype.eb;F.prototype["delete"]=F.prototype.delete;F.prototype.remove=F.prototype.remove;F.prototype.insertAt=F.prototype.wb;
F.prototype.pop=F.prototype.pop;F.prototype.last=F.prototype.$b;F.prototype.first=F.prototype.first;F.prototype.set=F.prototype.set;F.prototype.setElt=F.prototype.Pc;F.prototype.get=F.prototype.get;F.prototype.elt=F.prototype.J;F.prototype.indexOf=F.prototype.indexOf;F.prototype.has=F.prototype.has;F.prototype.contains=F.prototype.contains;F.prototype.clear=F.prototype.clear;F.prototype.addAll=F.prototype.addAll;F.prototype.push=F.prototype.push;F.prototype.add=F.prototype.add;F.prototype.thaw=F.prototype.ea;
F.prototype.freeze=F.prototype.freeze;F.className="List";function ib(a){this.fg=a;a.Ja=null;this.ia=a.Da;this.ka=null}ib.prototype.reset=function(){var a=this.fg;a.Ja=null;this.ia=a.Da;this.ka=null};ib.prototype.next=function(){var a=this.fg;if(a.Da!==this.ia&&null===this.key)return!1;var b=this.ka;b=null===b?a.ba:b.oa;if(null!==b)return this.ka=b,this.value=b.value,this.key=b.key,!0;this.Td();return!1};ib.prototype.rd=function(){return this.next()};
ib.prototype.first=function(){var a=this.fg;this.ia=a.Da;a=a.ba;if(null!==a){this.ka=a;var b=a.value;this.key=a.key;return this.value=b}return null};ib.prototype.any=function(a){var b=this.fg;this.ka=b.Ja=null;for(b=b.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};ib.prototype.all=function(a){var b=this.fg;this.ka=b.Ja=null;for(b=b.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};ib.prototype.each=function(a){var b=this.fg;this.ka=b.Ja=null;for(b=b.ba;null!==b;)a(b.value),b=b.oa;return this};
ib.prototype.map=function(a){var b=this.fg;b.Ja=null;var c=new F;for(b=b.ba;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};ib.prototype.filter=function(a){var b=this.fg;b.Ja=null;var c=new F;for(b=b.ba;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.oa}return c.iterator};ib.prototype.Td=function(){this.value=this.key=null;this.ia=-1;this.fg.Ja=this};ib.prototype.toString=function(){return null!==this.ka?"SetIterator@"+this.ka.value:"SetIterator"};
na.Object.defineProperties(ib.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.fg.Ib}}});ib.prototype.first=ib.prototype.first;ib.prototype.hasNext=ib.prototype.rd;ib.prototype.next=ib.prototype.next;ib.prototype.reset=ib.prototype.reset;ib.className="SetIterator";
function G(a){Ua(this);this.v=!1;this.Jb={};this.Ib=0;this.Ja=null;this.Da=0;this.$e=this.ba=null;"string"===typeof a&&C("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type.");void 0!==a&&this.addAll(a)}t=G.prototype;t.lb=function(){var a=this.Da;a++;999999999<a&&(a=0);this.Da=a};t.freeze=function(){this.v=!0;return this};t.ea=function(){this.v=!1;return this};t.toString=function(){return"Set()#"+fb(this)};
t.add=function(a){if(null===a)return this;this.v&&wa(this,a);var b=a;za(a)&&(b=jb(a));void 0===this.Jb[b]&&(this.Ib++,a=new kb(a,a),this.Jb[b]=a,b=this.$e,null===b?this.ba=a:(a.vl=b,b.oa=a),this.$e=a,this.lb());return this};t.addAll=function(a){if(null===a)return this;this.v&&wa(this);if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.add(a[c]);else for(a=a.iterator;a.next();)this.add(a.value);return this};
t.contains=function(a){if(null===a)return!1;var b=a;return za(a)&&(b=fb(a),void 0===b)?!1:void 0!==this.Jb[b]};t.has=function(a){return this.contains(a)};t.oz=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(!this.contains(a.value))return!1;return!0};t.pz=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(this.contains(a.value))return!0;return!1};t.first=function(){var a=this.ba;return null===a?null:a.value};
G.prototype.any=function(a){for(var b=this.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};G.prototype.all=function(a){for(var b=this.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};G.prototype.each=function(a){for(var b=this.ba;null!==b;)a(b.value),b=b.oa;return this};G.prototype.map=function(a){for(var b=new G,c=this.ba;null!==c;)b.add(a(c.value)),c=c.oa;return b};G.prototype.filter=function(a){for(var b=new G,c=this.ba;null!==c;){var d=c.value;a(d)&&b.add(d);c=c.oa}return b};t=G.prototype;
t.remove=function(a){if(null===a)return!1;this.v&&wa(this,a);var b=a;if(za(a)&&(b=fb(a),void 0===b))return!1;a=this.Jb[b];if(void 0===a)return!1;var c=a.oa,d=a.vl;null!==c&&(c.vl=d);null!==d&&(d.oa=c);this.ba===a&&(this.ba=c);this.$e===a&&(this.$e=d);delete this.Jb[b];this.Ib--;this.lb();return!0};t.delete=function(a){return this.remove(a)};
t.oq=function(a){if(null===a)return this;this.v&&wa(this);if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.remove(a[c]);else for(a=a.iterator;a.next();)this.remove(a.value);return this};t.LA=function(a){if(null===a||0===this.count)return this;this.v&&wa(this);var b=new G;b.addAll(a);a=[];for(var c=this.iterator;c.next();){var d=c.value;b.contains(d)||a.push(d)}this.oq(a);return this};t.clear=function(){this.v&&wa(this);this.Jb={};this.Ib=0;null!==this.Ja&&this.Ja.reset();this.$e=this.ba=null;this.lb()};
G.prototype.copy=function(){var a=new G,b=this.Jb,c;for(c in b)a.add(b[c].value);return a};G.prototype.ya=function(){var a=Array(this.Ib),b=this.Jb,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};G.prototype.Pv=function(){var a=new F,b=this.Jb,c;for(c in b)a.add(b[c].value);return a};function Ua(a){a.__gohashid=lb++}function jb(a){var b=a.__gohashid;void 0===b&&(b=lb++,a.__gohashid=b);return b}function fb(a){return a.__gohashid}
na.Object.defineProperties(G.prototype,{count:{get:function(){return this.Ib}},size:{get:function(){return this.Ib}},iterator:{get:function(){if(0>=this.Ib)return $a;var a=this.Ja;return null!==a?(a.reset(),a):new ib(this)}}});G.prototype.toList=G.prototype.Pv;G.prototype.toArray=G.prototype.ya;G.prototype.clear=G.prototype.clear;G.prototype.retainAll=G.prototype.LA;G.prototype.removeAll=G.prototype.oq;
G.prototype["delete"]=G.prototype.delete;G.prototype.remove=G.prototype.remove;G.prototype.first=G.prototype.first;G.prototype.containsAny=G.prototype.pz;G.prototype.containsAll=G.prototype.oz;G.prototype.has=G.prototype.has;G.prototype.contains=G.prototype.contains;G.prototype.addAll=G.prototype.addAll;G.prototype.add=G.prototype.add;G.prototype.thaw=G.prototype.ea;G.prototype.freeze=G.prototype.freeze;var lb=1;G.className="Set";G.uniqueHash=Ua;G.hashIdUnique=jb;G.hashId=fb;
function mb(a){this.ga=a;this.ia=a.Da;this.ka=null}mb.prototype.reset=function(){this.ia=this.ga.Da;this.ka=null};mb.prototype.next=function(){var a=this.ga;if(a.Da!==this.ia&&null===this.key)return!1;var b=this.ka;b=null===b?a.ba:b.oa;if(null!==b)return this.ka=b,this.value=this.key=a=b.key,!0;this.Td();return!1};mb.prototype.rd=function(){return this.next()};mb.prototype.first=function(){var a=this.ga;this.ia=a.Da;a=a.ba;return null!==a?(this.ka=a,this.value=this.key=a=a.key):null};
mb.prototype.any=function(a){var b=this.ga;this.ka=null;for(b=b.ba;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};mb.prototype.all=function(a){var b=this.ga;this.ka=null;for(b=b.ba;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};mb.prototype.each=function(a){var b=this.ga;this.ka=null;for(b=b.ba;null!==b;)a(b.key),b=b.oa;return this};mb.prototype.map=function(a){var b=this.ga;this.ka=null;var c=new F;for(b=b.ba;null!==b;)c.add(a(b.key)),b=b.oa;return c.iterator};
mb.prototype.filter=function(a){var b=this.ga;this.ka=null;var c=new F;for(b=b.ba;null!==b;){var d=b.key;a(d)&&c.add(d);b=b.oa}return c.iterator};mb.prototype.Td=function(){this.value=this.key=null;this.ia=-1};mb.prototype.toString=function(){return null!==this.ka?"MapKeySetIterator@"+this.ka.value:"MapKeySetIterator"};na.Object.defineProperties(mb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ga.Ib}}});
mb.prototype.first=mb.prototype.first;mb.prototype.hasNext=mb.prototype.rd;mb.prototype.next=mb.prototype.next;mb.prototype.reset=mb.prototype.reset;mb.className="MapKeySetIterator";function nb(a){G.call(this);Ua(this);this.v=!0;this.ga=a}ma(nb,G);t=nb.prototype;t.freeze=function(){return this};t.ea=function(){return this};t.toString=function(){return"MapKeySet("+this.ga.toString()+")"};t.add=function(){C("This Set is read-only: "+this.toString())};t.contains=function(a){return this.ga.contains(a)};
t.has=function(a){return this.contains(a)};t.remove=function(){C("This Set is read-only: "+this.toString())};t.delete=function(a){return this.remove(a)};t.clear=function(){C("This Set is read-only: "+this.toString())};t.first=function(){var a=this.ga.ba;return null!==a?a.key:null};nb.prototype.any=function(a){for(var b=this.ga.ba;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};nb.prototype.all=function(a){for(var b=this.ga.ba;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};
nb.prototype.each=function(a){for(var b=this.ga.ba;null!==b;)a(b.key),b=b.oa;return this};nb.prototype.map=function(a){for(var b=new G,c=this.ga.ba;null!==c;)b.add(a(c.key)),c=c.oa;return b};nb.prototype.filter=function(a){for(var b=new G,c=this.ga.ba;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.oa}return b};nb.prototype.copy=function(){return new nb(this.ga)};nb.prototype.Qv=function(){var a=new G,b=this.ga.Jb,c;for(c in b)a.add(b[c].key);return a};
nb.prototype.ya=function(){var a=this.ga.Jb,b=Array(this.ga.Ib),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};nb.prototype.Pv=function(){var a=new F,b=this.ga.Jb,c;for(c in b)a.add(b[c].key);return a};na.Object.defineProperties(nb.prototype,{count:{get:function(){return this.ga.Ib}},size:{get:function(){return this.ga.Ib}},iterator:{get:function(){return 0>=this.ga.Ib?$a:new mb(this.ga)}}});
nb.prototype.toList=nb.prototype.Pv;nb.prototype.toArray=nb.prototype.ya;nb.prototype.toSet=nb.prototype.Qv;nb.prototype.first=nb.prototype.first;nb.prototype.clear=nb.prototype.clear;nb.prototype["delete"]=nb.prototype.delete;nb.prototype.remove=nb.prototype.remove;nb.prototype.has=nb.prototype.has;nb.prototype.contains=nb.prototype.contains;nb.prototype.add=nb.prototype.add;nb.prototype.thaw=nb.prototype.ea;nb.prototype.freeze=nb.prototype.freeze;nb.className="MapKeySet";
function ob(a){this.ga=a;a.Ze=null;this.ia=a.Da;this.ka=null}ob.prototype.reset=function(){var a=this.ga;a.Ze=null;this.ia=a.Da;this.ka=null};ob.prototype.next=function(){var a=this.ga;if(a.Da!==this.ia&&null===this.key)return!1;var b=this.ka;b=null===b?a.ba:b.oa;if(null!==b)return this.ka=b,this.value=b.value,this.key=b.key,!0;this.Td();return!1};ob.prototype.rd=function(){return this.next()};
ob.prototype.first=function(){var a=this.ga;this.ia=a.Da;a=a.ba;if(null!==a){this.ka=a;var b=a.value;this.key=a.key;return this.value=b}return null};ob.prototype.any=function(a){var b=this.ga;this.ka=b.Ze=null;for(b=b.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};ob.prototype.all=function(a){var b=this.ga;this.ka=b.Ze=null;for(b=b.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};ob.prototype.each=function(a){var b=this.ga;this.ka=b.Ze=null;for(b=b.ba;null!==b;)a(b.value),b=b.oa;return this};
ob.prototype.map=function(a){var b=this.ga;this.ka=b.Ze=null;var c=new F;for(b=b.ba;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};ob.prototype.filter=function(a){var b=this.ga;this.ka=b.Ze=null;var c=new F;for(b=b.ba;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.oa}return c.iterator};ob.prototype.Td=function(){this.value=this.key=null;this.ia=-1;this.ga.Ze=this};ob.prototype.toString=function(){return null!==this.ka?"MapValueSetIterator@"+this.ka.value:"MapValueSetIterator"};
na.Object.defineProperties(ob.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ga.Ib}}});ob.prototype.first=ob.prototype.first;ob.prototype.hasNext=ob.prototype.rd;ob.prototype.next=ob.prototype.next;ob.prototype.reset=ob.prototype.reset;ob.className="MapValueSetIterator";function kb(a,b){this.key=a;this.value=b;this.vl=this.oa=null}kb.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};
kb.className="KeyValuePair";function pb(a){this.ga=a;a.Ja=null;this.ia=a.Da;this.ka=null}pb.prototype.reset=function(){var a=this.ga;a.Ja=null;this.ia=a.Da;this.ka=null};pb.prototype.next=function(){var a=this.ga;if(a.Da!==this.ia&&null===this.key)return!1;var b=this.ka;b=null===b?a.ba:b.oa;if(null!==b)return this.ka=b,this.key=b.key,this.value=b.value,!0;this.Td();return!1};pb.prototype.rd=function(){return this.next()};
pb.prototype.first=function(){var a=this.ga;this.ia=a.Da;a=a.ba;return null!==a?(this.ka=a,this.key=a.key,this.value=a.value,a):null};pb.prototype.any=function(a){var b=this.ga;this.ka=b.Ja=null;for(b=b.ba;null!==b;){if(a(b))return!0;b=b.oa}return!1};pb.prototype.all=function(a){var b=this.ga;this.ka=b.Ja=null;for(b=b.ba;null!==b;){if(!a(b))return!1;b=b.oa}return!0};pb.prototype.each=function(a){var b=this.ga;this.ka=b.Ja=null;for(b=b.ba;null!==b;)a(b),b=b.oa;return this};
pb.prototype.map=function(a){var b=this.ga;this.ka=b.Ja=null;var c=new F;for(b=b.ba;null!==b;)c.add(a(b)),b=b.oa;return c.iterator};pb.prototype.filter=function(a){var b=this.ga;this.ka=b.Ja=null;var c=new F;for(b=b.ba;null!==b;)a(b)&&c.add(b),b=b.oa;return c.iterator};pb.prototype.Td=function(){this.value=this.key=null;this.ia=-1;this.ga.Ja=this};pb.prototype.toString=function(){return null!==this.ka?"MapIterator@"+this.ka:"MapIterator"};
na.Object.defineProperties(pb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ga.Ib}}});pb.prototype.first=pb.prototype.first;pb.prototype.hasNext=pb.prototype.rd;pb.prototype.next=pb.prototype.next;pb.prototype.reset=pb.prototype.reset;pb.className="MapIterator";
function I(a){Ua(this);this.v=!1;this.Jb={};this.Ib=0;this.Ze=this.Ja=null;this.Da=0;this.$e=this.ba=null;"string"===typeof a&&C("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type.");void 0!==a&&this.addAll(a)}t=I.prototype;t.lb=function(){var a=this.Da;a++;999999999<a&&(a=0);this.Da=a};t.freeze=function(){this.v=!0;return this};t.ea=function(){this.v=!1;return this};t.toString=function(){return"Map()#"+fb(this)};
t.add=function(a,b){this.v&&wa(this,a);var c=a;za(a)&&(c=jb(a));var d=this.Jb[c];void 0===d?(this.Ib++,a=new kb(a,b),this.Jb[c]=a,c=this.$e,null===c?this.ba=a:(a.vl=c,c.oa=a),this.$e=a,this.lb()):d.value=b;return this};t.set=function(a,b){return this.add(a,b)};
t.addAll=function(a){if(null===a)return this;if(Aa(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];this.add(d.key,d.value)}else if(a instanceof I)for(a=a.iterator;a.next();)this.add(a.key,a.value);else for(a=a.iterator;a.next();)b=a.value,this.add(b.key,b.value);return this};t.first=function(){return this.ba};I.prototype.any=function(a){for(var b=this.ba;null!==b;){if(a(b))return!0;b=b.oa}return!1};I.prototype.all=function(a){for(var b=this.ba;null!==b;){if(!a(b))return!1;b=b.oa}return!0};
I.prototype.each=function(a){for(var b=this.ba;null!==b;)a(b),b=b.oa;return this};I.prototype.map=function(a){for(var b=new I,c=this.ba;null!==c;)b.add(c.key,a(c)),c=c.oa;return b};I.prototype.filter=function(a){for(var b=new I,c=this.ba;null!==c;)a(c)&&b.add(c.key,c.value),c=c.oa;return b};t=I.prototype;t.contains=function(a){var b=a;return za(a)&&(b=fb(a),void 0===b)?!1:void 0!==this.Jb[b]};t.has=function(a){return this.contains(a)};
t.H=function(a){var b=a;if(za(a)&&(b=fb(a),void 0===b))return null;a=this.Jb[b];return void 0===a?null:a.value};t.get=function(a){return this.H(a)};t.remove=function(a){if(null===a)return!1;this.v&&wa(this,a);var b=a;if(za(a)&&(b=fb(a),void 0===b))return!1;a=this.Jb[b];if(void 0===a)return!1;var c=a.oa,d=a.vl;null!==c&&(c.vl=d);null!==d&&(d.oa=c);this.ba===a&&(this.ba=c);this.$e===a&&(this.$e=d);delete this.Jb[b];this.Ib--;this.lb();return!0};t.delete=function(a){return this.remove(a)};
t.clear=function(){this.v&&wa(this);this.Jb={};this.Ib=0;null!==this.Ja&&this.Ja.reset();null!==this.Ze&&this.Ze.reset();this.$e=this.ba=null;this.lb()};I.prototype.copy=function(){var a=new I,b=this.Jb,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};I.prototype.ya=function(){var a=this.Jb,b=Array(this.Ib),c=0,d;for(d in a){var e=a[d];b[c]=new kb(e.key,e.value);c++}return b};I.prototype.If=function(){return new nb(this)};
na.Object.defineProperties(I.prototype,{count:{get:function(){return this.Ib}},size:{get:function(){return this.Ib}},iterator:{get:function(){if(0>=this.count)return $a;var a=this.Ja;return null!==a?(a.reset(),a):new pb(this)}},iteratorKeys:{get:function(){return 0>=this.count?$a:new mb(this)}},iteratorValues:{get:function(){if(0>=this.count)return $a;
var a=this.Ze;return null!==a?(a.reset(),a):new ob(this)}}});I.prototype.toKeySet=I.prototype.If;I.prototype.toArray=I.prototype.ya;I.prototype.clear=I.prototype.clear;I.prototype["delete"]=I.prototype.delete;I.prototype.remove=I.prototype.remove;I.prototype.get=I.prototype.get;I.prototype.getValue=I.prototype.H;I.prototype.has=I.prototype.has;I.prototype.contains=I.prototype.contains;I.prototype.first=I.prototype.first;I.prototype.addAll=I.prototype.addAll;I.prototype.set=I.prototype.set;
I.prototype.add=I.prototype.add;I.prototype.thaw=I.prototype.ea;I.prototype.freeze=I.prototype.freeze;I.className="Map";function J(a,b){void 0===a?this.y=this.x=0:"number"===typeof a&&"number"===typeof b?(this.x=a,this.y=b):C("Invalid arguments to Point constructor: "+a+", "+b);this.v=!1}var qb,rb,sb,tb,ub;J.prototype.assign=function(a){this.x=a.x;this.y=a.y;return this};J.prototype.h=function(a,b){this.x=a;this.y=b;return this};J.prototype.sg=function(a,b){this.x=a;this.y=b;return this};
J.prototype.set=function(a){this.x=a.x;this.y=a.y;return this};J.prototype.copy=function(){var a=new J;a.x=this.x;a.y=this.y;return a};t=J.prototype;t.ca=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return this.v||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ea=function(){Object.isFrozen(this)&&C("cannot thaw constant: "+this);this.v=!1;return this};
function vb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new J(c,e)}return new J}function wb(a){return a.x.toString()+" "+a.y.toString()}t.toString=function(){return"Point("+this.x+","+this.y+")"};t.A=function(a){return a instanceof J?this.x===a.x&&this.y===a.y:!1};t.Fi=function(a,b){return this.x===a&&this.y===b};t.Ua=function(a){return L.w(this.x,a.x)&&L.w(this.y,a.y)};
t.add=function(a){this.x+=a.x;this.y+=a.y;return this};t.ie=function(a){this.x-=a.x;this.y-=a.y;return this};t.offset=function(a,b){this.x+=a;this.y+=b;return this};J.prototype.rotate=function(a){if(0===a)return this;var b=this.x,c=this.y;if(0===b&&0===c)return this;360<=a?a-=360:0>a&&(a+=360);if(90===a){a=0;var d=1}else 180===a?(a=-1,d=0):270===a?(a=0,d=-1):(d=a*Math.PI/180,a=Math.cos(d),d=Math.sin(d));this.x=a*b-d*c;this.y=d*b+a*c;return this};t=J.prototype;
t.scale=function(a,b){this.x*=a;this.y*=b;return this};t.xf=function(a){var b=a.x-this.x;a=a.y-this.y;return b*b+a*a};t.qd=function(a,b){a-=this.x;b-=this.y;return a*a+b*b};t.normalize=function(){var a=this.x,b=this.y,c=Math.sqrt(a*a+b*b);0<c&&(this.x=a/c,this.y=b/c);return this};t.Pa=function(a){return xb(a.x-this.x,a.y-this.y)};t.direction=function(a,b){return xb(a-this.x,b-this.y)};
function xb(a,b){if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;var c=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?c=0>b?c+180:180-c:0>b&&(c=360-c);return c}t.nz=function(a,b){return L.Vl(a.x,a.y,b.x,b.y,this.x,this.y)};t.BA=function(a,b,c,d){L.Ih(a,b,c,d,this.x,this.y,this);return this};t.CA=function(a,b){L.Ih(a.x,a.y,b.x,b.y,this.x,this.y,this);return this};t.QA=function(a,b,c,d){L.Wp(this.x,this.y,a,b,c,d,this);return this};
t.RA=function(a,b){L.Wp(this.x,this.y,a.x,a.y,b.width,b.height,this);return this};t.Ti=function(a,b){this.x=a.x+b.x*a.width+b.offsetX;this.y=a.y+b.y*a.height+b.offsetY;return this};t.Ui=function(a,b,c,d,e){this.x=a+e.x*c+e.offsetX;this.y=b+e.y*d+e.offsetY;return this};t.transform=function(a){a.Aa(this);return this};function yb(a,b){b.Hd(a);return a}
function zb(a,b,c,d,e,f){var g=e-c,h=f-d,k=g*g+h*h;c-=a;d-=b;var l=-c*g-d*h;if(0>=l||l>=k)return g=e-a,h=f-b,Math.min(c*c+d*d,g*g+h*h);a=g*d-h*c;return a*a/k}function Ab(a,b,c,d){a=c-a;b=d-b;return a*a+b*b}function Db(a,b,c,d){a=c-a;b=d-b;if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;d=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?d=0>b?d+180:180-d:0>b&&(d=360-d);return d}t.u=function(){return isFinite(this.x)&&isFinite(this.y)};
J.alloc=function(){var a=Eb.pop();return void 0===a?new J:a};J.allocAt=function(a,b){var c=Eb.pop();if(void 0===c)return new J(a,b);c.x=a;c.y=b;return c};J.free=function(a){Eb.push(a)};J.prototype.isReal=J.prototype.u;J.prototype.setSpot=J.prototype.Ui;J.prototype.setRectSpot=J.prototype.Ti;J.prototype.snapToGridPoint=J.prototype.RA;J.prototype.snapToGrid=J.prototype.QA;J.prototype.projectOntoLineSegmentPoint=J.prototype.CA;J.prototype.projectOntoLineSegment=J.prototype.BA;
J.intersectingLineSegments=function(a,b,c,d,e,f,g,h){return L.bm(a,b,c,d,e,f,g,h)};J.prototype.compareWithLineSegmentPoint=J.prototype.nz;J.compareWithLineSegment=function(a,b,c,d,e,f){return L.Vl(a,b,c,d,e,f)};J.prototype.direction=J.prototype.direction;J.prototype.directionPoint=J.prototype.Pa;J.prototype.normalize=J.prototype.normalize;J.prototype.distanceSquared=J.prototype.qd;J.prototype.distanceSquaredPoint=J.prototype.xf;J.prototype.scale=J.prototype.scale;J.prototype.rotate=J.prototype.rotate;
J.prototype.offset=J.prototype.offset;J.prototype.subtract=J.prototype.ie;J.prototype.add=J.prototype.add;J.prototype.equalsApprox=J.prototype.Ua;J.prototype.equalTo=J.prototype.Fi;J.prototype.equals=J.prototype.A;J.prototype.set=J.prototype.set;J.prototype.setTo=J.prototype.sg;var Eb=[];J.className="Point";J.parse=vb;J.stringify=wb;J.distanceLineSegmentSquared=zb;J.distanceSquared=Ab;J.direction=Db;J.Origin=qb=(new J(0,0)).ca();J.InfiniteTopLeft=rb=(new J(-Infinity,-Infinity)).ca();
J.InfiniteBottomRight=sb=(new J(Infinity,Infinity)).ca();J.SixPoint=tb=(new J(6,6)).ca();J.NoPoint=ub=(new J(NaN,NaN)).ca();J.parse=vb;J.stringify=wb;J.distanceLineSegmentSquared=zb;J.distanceSquared=Ab;J.direction=Db;function Fb(a,b){void 0===a?this.height=this.width=0:"number"===typeof a&&(0<=a||isNaN(a))&&"number"===typeof b&&(0<=b||isNaN(b))?(this.width=a,this.height=b):C("Invalid arguments to Size constructor: "+a+", "+b);this.v=!1}var Gb,Hb,Ib,Jb,Kb,Lb,Mb;
Fb.prototype.assign=function(a){this.width=a.width;this.height=a.height;return this};Fb.prototype.h=function(a,b){this.width=a;this.height=b;return this};Fb.prototype.sg=function(a,b){this.width=a;this.height=b;return this};Fb.prototype.set=function(a){this.width=a.width;this.height=a.height;return this};Fb.prototype.copy=function(){var a=new Fb;a.width=this.width;a.height=this.height;return a};t=Fb.prototype;t.ca=function(){this.v=!0;Object.freeze(this);return this};
t.I=function(){return this.v||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ea=function(){Object.isFrozen(this)&&C("cannot thaw constant: "+this);this.v=!1;return this};function Nb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new Fb(c,e)}return new Fb}function Ob(a){return a.width.toString()+" "+a.height.toString()}
t.toString=function(){return"Size("+this.width+","+this.height+")"};t.A=function(a){return a instanceof Fb?this.width===a.width&&this.height===a.height:!1};t.Fi=function(a,b){return this.width===a&&this.height===b};t.Ua=function(a){return L.w(this.width,a.width)&&L.w(this.height,a.height)};t.u=function(){return isFinite(this.width)&&isFinite(this.height)};Fb.alloc=function(){var a=Pb.pop();return void 0===a?new Fb:a};Fb.free=function(a){Pb.push(a)};Fb.prototype.isReal=Fb.prototype.u;
Fb.prototype.equalsApprox=Fb.prototype.Ua;Fb.prototype.equalTo=Fb.prototype.Fi;Fb.prototype.equals=Fb.prototype.A;Fb.prototype.set=Fb.prototype.set;Fb.prototype.setTo=Fb.prototype.sg;var Pb=[];Fb.className="Size";Fb.parse=Nb;Fb.stringify=Ob;Fb.ZeroSize=Gb=(new Fb(0,0)).ca();Fb.OneSize=Hb=(new Fb(1,1)).ca();Fb.SixSize=Ib=(new Fb(6,6)).ca();Fb.EightSize=Jb=(new Fb(8,8)).ca();Fb.TenSize=Kb=(new Fb(10,10)).ca();Fb.InfiniteSize=Lb=(new Fb(Infinity,Infinity)).ca();Fb.NoSize=Mb=(new Fb(NaN,NaN)).ca();
Fb.parse=Nb;Fb.stringify=Ob;
function M(a,b,c,d){void 0===a?this.height=this.width=this.y=this.x=0:"number"===typeof a&&"number"===typeof b&&"number"===typeof c&&(0<=c||isNaN(c))&&"number"===typeof d&&(0<=d||isNaN(d))?(this.x=a,this.y=b,this.width=c,this.height=d):a instanceof J?(c=a.x,a=a.y,b instanceof J?(d=b.x,b=b.y,this.x=Math.min(c,d),this.y=Math.min(a,b),this.width=Math.abs(c-d),this.height=Math.abs(a-b)):b instanceof Fb?(this.x=c,this.y=a,this.width=b.width,this.height=b.height):C("Incorrect second argument supplied to Rect constructor "+b)):
C("Invalid arguments to Rect constructor: "+a+", "+b+", "+c+", "+d);this.v=!1}t=M.prototype;t.assign=function(a){this.x=a.x;this.y=a.y;this.width=a.width;this.height=a.height;return this};t.h=function(a,b,c,d){this.x=a;this.y=b;this.width=c;this.height=d;return this};function Qb(a,b,c){a.width=b;a.height=c}t.sg=function(a,b,c,d){this.x=a;this.y=b;this.width=c;this.height=d;return this};t.set=function(a){this.x=a.x;this.y=a.y;this.width=a.width;this.height=a.height;return this};
t.Qc=function(a){this.x=a.x;this.y=a.y;return this};t.PA=function(a){this.width=a.width;this.height=a.height;return this};M.prototype.copy=function(){var a=new M;a.x=this.x;a.y=this.y;a.width=this.width;a.height=this.height;return a};t=M.prototype;t.ca=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return this.v||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};
t.ea=function(){Object.isFrozen(this)&&C("cannot thaw constant: "+this);this.v=!1;return this};function Rb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return new M(c,e,f,g)}return new M}
function Sb(a){return a.x.toString()+" "+a.y.toString()+" "+a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"};t.A=function(a){return a instanceof M?this.x===a.x&&this.y===a.y&&this.width===a.width&&this.height===a.height:!1};t.Fi=function(a,b,c,d){return this.x===a&&this.y===b&&this.width===c&&this.height===d};t.Ua=function(a){return L.w(this.x,a.x)&&L.w(this.y,a.y)&&L.w(this.width,a.width)&&L.w(this.height,a.height)};
function Tb(a,b){return L.aa(a.x,b.x)&&L.aa(a.y,b.y)&&L.aa(a.width,b.width)&&L.aa(a.height,b.height)}t.$=function(a){return this.x<=a.x&&this.x+this.width>=a.x&&this.y<=a.y&&this.y+this.height>=a.y};t.Ge=function(a){return this.x<=a.x&&a.x+a.width<=this.x+this.width&&this.y<=a.y&&a.y+a.height<=this.y+this.height};t.contains=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return this.x<=a&&a+c<=this.x+this.width&&this.y<=b&&b+d<=this.y+this.height};
t.offset=function(a,b){this.x+=a;this.y+=b;return this};t.Kc=function(a,b){return Ub(this,b,a,b,a)};t.Lp=function(a){return Ub(this,a.top,a.right,a.bottom,a.left)};t.Nv=function(a){return Ub(this,-a.top,-a.right,-a.bottom,-a.left)};t.eA=function(a,b,c,d){return Ub(this,a,b,c,d)};function Ub(a,b,c,d,e){var f=a.width;c+e<=-f?(a.x+=f/2,a.width=0):(a.x-=e,a.width+=c+e);c=a.height;b+d<=-c?(a.y+=c/2,a.height=0):(a.y-=b,a.height+=b+d);return a}t.Zx=function(a){return Vb(this,a.x,a.y,a.width,a.height)};
t.$u=function(a,b,c,d){return Vb(this,a,b,c,d)};function Vb(a,b,c,d,e){var f=Math.max(a.x,b),g=Math.max(a.y,c);b=Math.min(a.x+a.width,b+d);c=Math.min(a.y+a.height,c+e);a.x=f;a.y=g;a.width=Math.max(0,b-f);a.height=Math.max(0,c-g);return a}t.Mc=function(a){return this.av(a.x,a.y,a.width,a.height)};
t.av=function(a,b,c,d){var e=this.width,f=this.x;if(Infinity!==e&&Infinity!==c&&(e+=f,c+=a,isNaN(c)||isNaN(e)||f>c||a>e))return!1;a=this.height;c=this.y;return Infinity!==a&&Infinity!==d&&(a+=c,d+=b,isNaN(d)||isNaN(a)||c>d||b>a)?!1:!0};function Zb(a,b){var c=a.width,d=a.x,e=b.x-10;if(d>b.width+10+10+e||e>c+d)return!1;c=a.height;a=a.y;d=b.y-10;return a>b.height+10+10+d||d>c+a?!1:!0}t.Oe=function(a){return $b(this,a.x,a.y,0,0)};t.Rc=function(a){return $b(this,a.x,a.y,a.width,a.height)};
t.Tv=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return $b(this,a,b,c,d)};function $b(a,b,c,d,e){var f=Math.min(a.x,b),g=Math.min(a.y,c);b=Math.max(a.x+a.width,b+d);c=Math.max(a.y+a.height,c+e);a.x=f;a.y=g;a.width=b-f;a.height=c-g;return a}t.Ui=function(a,b,c){this.x=a-c.offsetX-c.x*this.width;this.y=b-c.offsetY-c.y*this.height;return this};function ac(a,b,c,d,e,f,g,h){void 0===g&&(g=0);void 0===h&&(h=0);return a<=e&&e+g<=a+c&&b<=f&&f+h<=b+d}
function bc(a,b,c,d,e,f,g,h){return a>g+e||e>c+a?!1:b>h+f||f>d+b?!1:!0}t.u=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)};t.kA=function(){return 0===this.width&&0===this.height};M.alloc=function(){var a=fc.pop();return void 0===a?new M:a};M.allocAt=function(a,b,c,d){var e=fc.pop();return void 0===e?new M(a,b,c,d):e.h(a,b,c,d)};M.free=function(a){fc.push(a)};
na.Object.defineProperties(M.prototype,{left:{get:function(){return this.x},set:function(a){this.x=a}},top:{get:function(){return this.y},set:function(a){this.y=a}},right:{get:function(){return this.x+this.width},set:function(a){this.x+=a-(this.x+this.width)}},bottom:{get:function(){return this.y+this.height},set:function(a){this.y+=a-(this.y+this.height)}},position:{
get:function(){return new J(this.x,this.y)},set:function(a){this.x=a.x;this.y=a.y}},size:{get:function(){return new Fb(this.width,this.height)},set:function(a){this.width=a.width;this.height=a.height}},center:{get:function(){return new J(this.x+this.width/2,this.y+this.height/2)},set:function(a){this.x=a.x-this.width/2;this.y=a.y-this.height/2}},centerX:{get:function(){return this.x+this.width/
2},set:function(a){this.x=a-this.width/2}},centerY:{get:function(){return this.y+this.height/2},set:function(a){this.y=a-this.height/2}}});M.prototype.isEmpty=M.prototype.kA;M.prototype.isReal=M.prototype.u;M.intersectsLineSegment=function(a,b,c,d,e,f,g,h){return L.$x(a,b,c,d,e,f,g,h)};M.prototype.setSpot=M.prototype.Ui;M.prototype.union=M.prototype.Tv;M.prototype.unionRect=M.prototype.Rc;M.prototype.unionPoint=M.prototype.Oe;M.prototype.intersects=M.prototype.av;
M.prototype.intersectsRect=M.prototype.Mc;M.prototype.intersect=M.prototype.$u;M.prototype.intersectRect=M.prototype.Zx;M.prototype.grow=M.prototype.eA;M.prototype.subtractMargin=M.prototype.Nv;M.prototype.addMargin=M.prototype.Lp;M.prototype.inflate=M.prototype.Kc;M.prototype.offset=M.prototype.offset;M.prototype.contains=M.prototype.contains;M.prototype.containsRect=M.prototype.Ge;M.prototype.containsPoint=M.prototype.$;M.prototype.equalsApprox=M.prototype.Ua;M.prototype.equalTo=M.prototype.Fi;
M.prototype.equals=M.prototype.A;M.prototype.setSize=M.prototype.PA;M.prototype.setPoint=M.prototype.Qc;M.prototype.set=M.prototype.set;M.prototype.setTo=M.prototype.sg;var gc=null,hc=null,fc=[];M.className="Rect";M.parse=Rb;M.stringify=Sb;M.contains=ac;M.intersects=bc;M.ZeroRect=gc=(new M(0,0,0,0)).ca();M.NoRect=hc=(new M(NaN,NaN,NaN,NaN)).ca();M.parse=Rb;M.stringify=Sb;M.contains=ac;M.intersects=bc;
function kc(a,b,c,d){void 0===a?this.left=this.bottom=this.right=this.top=0:void 0===b?this.left=this.bottom=this.right=this.top=a:void 0===c?(this.top=a,this.right=b,this.bottom=a,this.left=b):void 0!==d?(this.top=a,this.right=b,this.bottom=c,this.left=d):C("Invalid arguments to Margin constructor: "+a+", "+b+", "+c+", "+d);this.v=!1}kc.prototype.assign=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};
kc.prototype.sg=function(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d;return this};kc.prototype.set=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};kc.prototype.copy=function(){var a=new kc;a.top=this.top;a.right=this.right;a.bottom=this.bottom;a.left=this.left;return a};t=kc.prototype;t.ca=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return this.v||Object.isFrozen(this)?this:this.copy().freeze()};
t.freeze=function(){this.v=!0;return this};t.ea=function(){Object.isFrozen(this)&&C("cannot thaw constant: "+this);this.v=!1;return this};
function lc(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=NaN;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));if(isNaN(c))return new kc;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new kc(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new kc(c,e);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return isNaN(g)?new kc(c,e):new kc(c,e,f,g)}return new kc}
function mc(a){return a.top.toString()+" "+a.right.toString()+" "+a.bottom.toString()+" "+a.left.toString()}t.toString=function(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"};t.A=function(a){return a instanceof kc?this.top===a.top&&this.right===a.right&&this.bottom===a.bottom&&this.left===a.left:!1};t.Fi=function(a,b,c,d){return this.top===a&&this.right===b&&this.bottom===c&&this.left===d};
t.Ua=function(a){return L.w(this.top,a.top)&&L.w(this.right,a.right)&&L.w(this.bottom,a.bottom)&&L.w(this.left,a.left)};t.u=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};kc.alloc=function(){var a=nc.pop();return void 0===a?new kc:a};kc.free=function(a){nc.push(a)};kc.prototype.isReal=kc.prototype.u;kc.prototype.equalsApprox=kc.prototype.Ua;kc.prototype.equalTo=kc.prototype.Fi;kc.prototype.equals=kc.prototype.A;kc.prototype.set=kc.prototype.set;
kc.prototype.setTo=kc.prototype.sg;var oc=null,pc=null,nc=[];kc.className="Margin";kc.parse=lc;kc.stringify=mc;kc.ZeroMargin=oc=(new kc(0,0,0,0)).ca();kc.TwoMargin=pc=(new kc(2,2,2,2)).ca();kc.parse=lc;kc.stringify=mc;function N(a,b,c,d){void 0===a?this.offsetY=this.offsetX=this.y=this.x=0:(void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),this.x=a,this.y=b,this.offsetX=c,this.offsetY=d);this.v=!1}
var qc,tc,uc,vc,wc,xc,yc,zc,Ac,Bc,Dc,Ec,Fc,Gc,Hc,Ic,Jc,Kc,Lc,Mc,Oc,Pc,Qc,Rc,Sc,Tc,Uc,Xc,Yc,Zc,$c,ad,bd,cd,dd,ed;N.prototype.assign=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};N.prototype.sg=function(a,b,c,d){this.x=a;this.y=b;this.offsetX=c;this.offsetY=d;return this};N.prototype.set=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};
N.prototype.copy=function(){var a=new N;a.x=this.x;a.y=this.y;a.offsetX=this.offsetX;a.offsetY=this.offsetY;return a};t=N.prototype;t.ca=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return this.v||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ea=function(){Object.isFrozen(this)&&C("cannot thaw constant: "+this);this.v=!1;return this};function fd(a,b){a.x=NaN;a.y=NaN;a.offsetX=b;return a}
function gd(a){if("string"===typeof a){a=a.trim();if("None"===a)return qc;if("TopLeft"===a)return tc;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return uc;if("TopRight"===a)return vc;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return wc;if("Center"===a)return xc;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return yc;if("BottomLeft"===a)return zc;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return Ac;if("BottomRight"===a)return Bc;if("TopSide"===a)return Dc;if("LeftSide"===
a)return Ec;if("RightSide"===a)return Fc;if("BottomSide"===a)return Gc;if("TopBottomSides"===a)return Hc;if("LeftRightSides"===a)return Ic;if("TopLeftSides"===a)return Jc;if("TopRightSides"===a)return Kc;if("BottomLeftSides"===a)return Lc;if("BottomRightSides"===a)return Mc;if("NotTopSide"===a)return Oc;if("NotLeftSide"===a)return Pc;if("NotRightSide"===a)return Qc;if("NotBottomSide"===a)return Rc;if("AllSides"===a)return Sc;if("Default"===a)return Tc;a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;
var d=a[b++];void 0!==d&&0<d.length&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(g=parseFloat(d));return new N(c,e,f,g)}return new N}function ld(a){return a.hb()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()}
t.toString=function(){return this.hb()?0===this.offsetX&&0===this.offsetY?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.A(qc)?"None":this.A(tc)?"TopLeft":this.A(uc)?"Top":this.A(vc)?"TopRight":this.A(wc)?"Left":this.A(xc)?"Center":this.A(yc)?"Right":this.A(zc)?"BottomLeft":this.A(Ac)?"Bottom":this.A(Bc)?"BottomRight":this.A(Dc)?"TopSide":this.A(Ec)?"LeftSide":this.A(Fc)?"RightSide":this.A(Gc)?"BottomSide":this.A(Hc)?"TopBottomSides":this.A(Ic)?
"LeftRightSides":this.A(Jc)?"TopLeftSides":this.A(Kc)?"TopRightSides":this.A(Lc)?"BottomLeftSides":this.A(Mc)?"BottomRightSides":this.A(Oc)?"NotTopSide":this.A(Pc)?"NotLeftSide":this.A(Qc)?"NotRightSide":this.A(Rc)?"NotBottomSide":this.A(Sc)?"AllSides":this.A(Tc)?"Default":"None"};t.A=function(a){return a instanceof N?(this.x===a.x||isNaN(this.x)&&isNaN(a.x))&&(this.y===a.y||isNaN(this.y)&&isNaN(a.y))&&this.offsetX===a.offsetX&&this.offsetY===a.offsetY:!1};
t.pv=function(){return new N(.5-(this.x-.5),.5-(this.y-.5),-this.offsetX,-this.offsetY)};t.Df=function(a){if(!this.Oc())return!1;if(!a.Oc())if(a.A(Uc))a=Ec;else if(a.A(Xc))a=Fc;else if(a.A(Yc))a=Dc;else if(a.A(Zc))a=Gc;else return!1;a=a.offsetY;return(this.offsetY&a)===a};t.hb=function(){return!isNaN(this.x)&&!isNaN(this.y)};t.Ac=function(){return isNaN(this.x)||isNaN(this.y)};t.Oc=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY};
t.Ds=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};t.Mb=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};N.alloc=function(){var a=md.pop();return void 0===a?new N:a};N.free=function(a){md.push(a)};N.prototype.isDefault=N.prototype.Mb;N.prototype.isNone=N.prototype.Ds;N.prototype.isSide=N.prototype.Oc;N.prototype.isNoSpot=N.prototype.Ac;N.prototype.isSpot=N.prototype.hb;N.prototype.includesSide=N.prototype.Df;
N.prototype.opposite=N.prototype.pv;N.prototype.equals=N.prototype.A;N.prototype.set=N.prototype.set;N.prototype.setTo=N.prototype.sg;var md=[];N.className="Spot";N.parse=gd;N.stringify=ld;N.None=qc=fd(new N(0,0,0,0),0).ca();N.Default=Tc=fd(new N(0,0,-1,0),-1).ca();N.TopLeft=tc=(new N(0,0,0,0)).ca();N.TopCenter=uc=(new N(.5,0,0,0)).ca();N.TopRight=vc=(new N(1,0,0,0)).ca();N.LeftCenter=wc=(new N(0,.5,0,0)).ca();N.Center=xc=(new N(.5,.5,0,0)).ca();N.RightCenter=yc=(new N(1,.5,0,0)).ca();
N.BottomLeft=zc=(new N(0,1,0,0)).ca();N.BottomCenter=Ac=(new N(.5,1,0,0)).ca();N.BottomRight=Bc=(new N(1,1,0,0)).ca();N.MiddleTop=$c=uc;N.MiddleLeft=ad=wc;N.MiddleRight=bd=yc;N.MiddleBottom=cd=Ac;N.Top=Yc=uc;N.Left=Uc=wc;N.Right=Xc=yc;N.Bottom=Zc=Ac;N.TopSide=Dc=fd(new N(0,0,1,1),1).ca();N.LeftSide=Ec=fd(new N(0,0,1,2),1).ca();N.RightSide=Fc=fd(new N(0,0,1,4),1).ca();N.BottomSide=Gc=fd(new N(0,0,1,8),1).ca();N.TopBottomSides=Hc=fd(new N(0,0,1,9),1).ca();N.LeftRightSides=Ic=fd(new N(0,0,1,6),1).ca();
N.TopLeftSides=Jc=fd(new N(0,0,1,3),1).ca();N.TopRightSides=Kc=fd(new N(0,0,1,5),1).ca();N.BottomLeftSides=Lc=fd(new N(0,0,1,10),1).ca();N.BottomRightSides=Mc=fd(new N(0,0,1,12),1).ca();N.NotTopSide=Oc=fd(new N(0,0,1,14),1).ca();N.NotLeftSide=Pc=fd(new N(0,0,1,13),1).ca();N.NotRightSide=Qc=fd(new N(0,0,1,11),1).ca();N.NotBottomSide=Rc=fd(new N(0,0,1,7),1).ca();N.AllSides=Sc=fd(new N(0,0,1,15),1).ca();dd=(new N(.156,.156)).ca();ed=(new N(.844,.844)).ca();N.parse=gd;N.stringify=ld;
function nd(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0}nd.prototype.set=function(a){this.m11=a.m11;this.m12=a.m12;this.m21=a.m21;this.m22=a.m22;this.dx=a.dx;this.dy=a.dy;return this};nd.prototype.setTransform=function(a,b,c,d,e,f){this.m11=a;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=f;return this};nd.prototype.copy=function(){var a=new nd;a.m11=this.m11;a.m12=this.m12;a.m21=this.m21;a.m22=this.m22;a.dx=this.dx;a.dy=this.dy;return a};
nd.prototype.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};nd.prototype.A=function(a){return this.m11===a.m11&&this.m12===a.m12&&this.m21===a.m21&&this.m22===a.m22&&this.dx===a.dx&&this.dy===a.dy};nd.prototype.Bs=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22};nd.prototype.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this};
nd.prototype.multiply=function(a){var b=this.m11*a.m11+this.m21*a.m12,c=this.m12*a.m11+this.m22*a.m12,d=this.m11*a.m21+this.m21*a.m22,e=this.m12*a.m21+this.m22*a.m22;this.dx=this.m11*a.dx+this.m21*a.dy+this.dx;this.dy=this.m12*a.dx+this.m22*a.dy+this.dy;this.m11=b;this.m12=c;this.m21=d;this.m22=e;return this};
nd.prototype.lv=function(a){var b=1/(a.m11*a.m22-a.m12*a.m21),c=a.m22*b,d=-a.m12*b,e=-a.m21*b,f=a.m11*b,g=b*(a.m21*a.dy-a.m22*a.dx);a=b*(a.m12*a.dx-a.m11*a.dy);b=this.m11*c+this.m21*d;c=this.m12*c+this.m22*d;d=this.m11*e+this.m21*f;e=this.m12*e+this.m22*f;this.dx=this.m11*g+this.m21*a+this.dx;this.dy=this.m12*g+this.m22*a+this.dy;this.m11=b;this.m12=c;this.m21=d;this.m22=e;return this};
nd.prototype.As=function(){var a=1/(this.m11*this.m22-this.m12*this.m21),b=-this.m12*a,c=-this.m21*a,d=this.m11*a,e=a*(this.m21*this.dy-this.m22*this.dx),f=a*(this.m12*this.dx-this.m11*this.dy);this.m11=this.m22*a;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=f;return this};
nd.prototype.rotate=function(a,b,c){360<=a?a-=360:0>a&&(a+=360);if(0===a)return this;this.translate(b,c);if(90===a){a=0;var d=1}else 180===a?(a=-1,d=0):270===a?(a=0,d=-1):(d=a*Math.PI/180,a=Math.cos(d),d=Math.sin(d));var e=this.m12*a+this.m22*d,f=this.m11*-d+this.m21*a,g=this.m12*-d+this.m22*a;this.m11=this.m11*a+this.m21*d;this.m12=e;this.m21=f;this.m22=g;this.translate(-b,-c);return this};t=nd.prototype;t.translate=function(a,b){this.dx+=this.m11*a+this.m21*b;this.dy+=this.m12*a+this.m22*b;return this};
t.scale=function(a,b){void 0===b&&(b=a);this.m11*=a;this.m12*=a;this.m21*=b;this.m22*=b;return this};t.Aa=function(a){var b=a.x,c=a.y;return a.h(b*this.m11+c*this.m21+this.dx,b*this.m12+c*this.m22+this.dy)};t.Hd=function(a){var b=1/(this.m11*this.m22-this.m12*this.m21),c=a.x,d=a.y;return a.h(c*this.m22*b+d*-this.m21*b+b*(this.m21*this.dy-this.m22*this.dx),c*-this.m12*b+d*this.m11*b+b*(this.m12*this.dx-this.m11*this.dy))};
t.yx=function(a){var b=1/(this.m11*this.m22-this.m12*this.m21),c=1.25*a.x,d=1.2*a.y;return a.h(c*this.m22*b+d*-this.m21*b+b*(this.m21*this.dy-this.m22*this.dx),c*-this.m12*b+d*this.m11*b+b*(this.m12*this.dx-this.m11*this.dy))};
t.wq=function(a){var b=a.x,c=a.y,d=b+a.width,e=c+a.height,f=this.m11,g=this.m12,h=this.m21,k=this.m22,l=this.dx,m=this.dy,n=b*f+c*h+l,p=b*g+c*k+m,r=d*f+c*h+l,q=d*g+c*k+m;c=b*f+e*h+l;b=b*g+e*k+m;f=d*f+e*h+l;d=d*g+e*k+m;e=Math.min(n,r);n=Math.max(n,r);r=Math.min(p,q);p=Math.max(p,q);e=Math.min(e,c);n=Math.max(n,c);r=Math.min(r,b);p=Math.max(p,b);e=Math.min(e,f);n=Math.max(n,f);r=Math.min(r,d);p=Math.max(p,d);a.h(e,r,n-e,p-r);return a};nd.alloc=function(){var a=od.pop();return void 0===a?new nd:a};
nd.free=function(a){od.push(a)};nd.prototype.transformRect=nd.prototype.wq;nd.prototype.transformPoint=nd.prototype.Aa;nd.prototype.scale=nd.prototype.scale;nd.prototype.translate=nd.prototype.translate;nd.prototype.rotate=nd.prototype.rotate;nd.prototype.invert=nd.prototype.As;nd.prototype.multiplyInverted=nd.prototype.lv;nd.prototype.multiply=nd.prototype.multiply;nd.prototype.reset=nd.prototype.reset;nd.prototype.isIdentity=nd.prototype.Bs;nd.prototype.equals=nd.prototype.A;
nd.prototype.setTransform=nd.prototype.setTransform;nd.prototype.set=nd.prototype.set;var od=[];nd.className="Transform";nd.xF="54a702f3e53909c447824c6706603faf4c";
var L={ZA:"7da71ca0ad381e90",vg:(Math.sqrt(2)-1)/3*4,rw:null,sqrt:function(a){if(0>=a)return 0;var b=L.rw;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);L.rw=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)},w:function(a,b){a-=b;return.5>a&&-.5<a},aa:function(a,b){a-=b;return 5E-8>a&&-5E-8<a},Nb:function(a,b,c,d,e,f,g){0>=e&&(e=1E-6);if(a<c){var h=a;var k=c}else h=c,k=a;if(b<d){var l=b;var m=d}else l=d,m=b;if(a===c)return l<=g&&g<=m&&a-e<=f&&f<=a+e;if(b===d)return h<=
f&&f<=k&&b-e<=g&&g<=b+e;k+=e;h-=e;if(h<=f&&f<=k&&(m+=e,l-=e,l<=g&&g<=m))if(k-h>m-l)if(a-c>e||c-a>e){if(f=(d-b)/(c-a)*(f-a)+b,f-e<=g&&g<=f+e)return!0}else return!0;else if(b-d>e||d-b>e){if(g=(c-a)/(d-b)*(g-b)+a,g-e<=f&&f<=g+e)return!0}else return!0;return!1},hs:function(a,b,c,d,e,f,g,h,k,l,m,n){if(L.Nb(a,b,g,h,n,c,d)&&L.Nb(a,b,g,h,n,e,f))return L.Nb(a,b,g,h,n,l,m);var p=(a+c)/2,r=(b+d)/2,q=(c+e)/2,u=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(p+q)/2;c=(r+u)/2;q=(q+e)/2;u=(u+f)/2;var w=(d+q)/2,v=(c+u)/2;return L.hs(a,
b,p,r,d,c,w,v,k,l,m,n)||L.hs(w,v,q,u,e,f,g,h,k,l,m,n)},iz:function(a,b,c,d,e,f,g,h,k){var l=(c+e)/2,m=(d+f)/2;k.h((((a+c)/2+l)/2+(l+(e+g)/2)/2)/2,(((b+d)/2+m)/2+(m+(f+h)/2)/2)/2);return k},hz:function(a,b,c,d,e,f,g,h){var k=(c+e)/2,l=(d+f)/2;return Db(((a+c)/2+k)/2,((b+d)/2+l)/2,(k+(e+g)/2)/2,(l+(f+h)/2)/2)},Tl:function(a,b,c,d,e,f,g,h,k,l){if(L.Nb(a,b,g,h,k,c,d)&&L.Nb(a,b,g,h,k,e,f))$b(l,a,b,0,0),$b(l,g,h,0,0);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,r=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+r)/
2;p=(p+e)/2;r=(r+f)/2;var q=(d+p)/2,u=(c+r)/2;L.Tl(a,b,m,n,d,c,q,u,k,l);L.Tl(q,u,p,r,e,f,g,h,k,l)}return l},Fe:function(a,b,c,d,e,f,g,h,k,l){if(L.Nb(a,b,g,h,k,c,d)&&L.Nb(a,b,g,h,k,e,f))0===l.length&&(l.push(a),l.push(b)),l.push(g),l.push(h);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,r=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+r)/2;p=(p+e)/2;r=(r+f)/2;var q=(d+p)/2,u=(c+r)/2;L.Fe(a,b,m,n,d,c,q,u,k,l);L.Fe(q,u,p,r,e,f,g,h,k,l)}return l},uv:function(a,b,c,d,e,f,g,h,k,l){if(L.Nb(a,b,e,f,l,c,d))return L.Nb(a,
b,e,f,l,h,k);var m=(a+c)/2,n=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var p=(m+c)/2,r=(n+d)/2;return L.uv(a,b,m,n,p,r,g,h,k,l)||L.uv(p,r,c,d,e,f,g,h,k,l)},nB:function(a,b,c,d,e,f,g){g.h(((a+c)/2+(c+e)/2)/2,((b+d)/2+(d+f)/2)/2);return g},tv:function(a,b,c,d,e,f,g,h){if(L.Nb(a,b,e,f,g,c,d))$b(h,a,b,0,0),$b(h,e,f,0,0);else{var k=(a+c)/2,l=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var m=(k+c)/2,n=(l+d)/2;L.tv(a,b,k,l,m,n,g,h);L.tv(m,n,c,d,e,f,g,h)}return h},kq:function(a,b,c,d,e,f,g,h){if(L.Nb(a,b,e,f,g,c,d))0===h.length&&(h.push(a),
h.push(b)),h.push(e),h.push(f);else{var k=(a+c)/2,l=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var m=(k+c)/2,n=(l+d)/2;L.kq(a,b,k,l,m,n,g,h);L.kq(m,n,c,d,e,f,g,h)}return h},Np:function(a,b,c,d,e,f,g,h,k,l,m,n,p,r){if(L.Nb(a,b,g,h,p,c,d)&&L.Nb(a,b,g,h,p,e,f)){if(!L.bm(a,b,g,h,k,l,m,n))return!1;p=(a-g)*(l-n)-(b-h)*(k-m);if(0===p)return!1;r.h(((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/p,((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/p);return!0}var q=(a+c)/2,u=(b+d)/2,w=(c+e)/2,v=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+w)/2;c=(u+v)/2;w=(w+e)/
2;v=(v+f)/2;var A=(d+w)/2,y=(c+v)/2,B=Infinity,z=!1,E=0,K=0;L.Np(a,b,q,u,d,c,A,y,k,l,m,n,p,r)&&(a=(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l),a<B&&(B=a,z=!0,E=r.x,K=r.y));L.Np(A,y,w,v,e,f,g,h,k,l,m,n,p,r)&&(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l)<B&&(z=!0,E=r.x,K=r.y);z&&(r.x=E,r.y=K);return z},Op:function(a,b,c,d,e,f,g,h,k,l,m,n,p){var r=0;if(L.Nb(a,b,g,h,p,c,d)&&L.Nb(a,b,g,h,p,e,f)){p=(a-g)*(l-n)-(b-h)*(k-m);if(0===p)return r;var q=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/p,u=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/p;if(q>=m)return r;
if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?(k=b,a=h):(k=h,a=b),u<k||u>a)return r}else if(a<g?(k=a,a=g):k=g,q<k||q>a)return r;0<p?r++:0>p&&r--}else{q=(a+c)/2;u=(b+d)/2;var w=(c+e)/2,v=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+w)/2;c=(u+v)/2;w=(w+e)/2;v=(v+f)/2;var A=(d+w)/2,y=(c+v)/2;r+=L.Op(a,b,q,u,d,c,A,y,k,l,m,n,p);r+=L.Op(A,y,w,v,e,f,g,h,k,l,m,n,p)}return r},Ih:function(a,b,c,d,e,f,g){if(L.aa(a,c)){b<d?(c=b,b=d):c=d;if(f<c)return g.h(a,c),!1;if(f>b)return g.h(a,b),!1;g.h(a,f);return!0}if(L.aa(b,d)){a<c?(d=
a,a=c):d=c;if(e<d)return g.h(d,b),!1;if(e>a)return g.h(a,b),!1;g.h(e,b);return!0}e=((a-e)*(a-c)+(b-f)*(b-d))/((c-a)*(c-a)+(d-b)*(d-b));if(-5E-6>e)return g.h(a,b),!1;if(1.000005<e)return g.h(c,d),!1;g.h(a+e*(c-a),b+e*(d-b));return!0},Le:function(a,b,c,d,e,f,g,h,k){if(L.w(a,c)&&L.w(b,d))return k.h(a,b),!1;if(L.aa(e,g))return L.aa(a,c)?(L.Ih(a,b,c,d,e,f,k),!1):L.Ih(a,b,c,d,e,(d-b)/(c-a)*(e-a)+b,k);h=(h-f)/(g-e);if(L.aa(a,c)){c=h*(a-e)+f;b<d?(e=b,b=d):e=d;if(c<e)return k.h(a,e),!1;if(c>b)return k.h(a,
b),!1;k.h(a,c);return!0}g=(d-b)/(c-a);if(L.aa(h,g))return L.Ih(a,b,c,d,e,f,k),!1;e=(g*a-h*e+f-b)/(g-h);if(L.aa(g,0)){a<c?(d=a,a=c):d=c;if(e<d)return k.h(d,b),!1;if(e>a)return k.h(a,b),!1;k.h(e,b);return!0}return L.Ih(a,b,c,d,e,g*(e-a)+b,k)},lB:function(a,b,c,d,e){return L.Le(c.x,c.y,d.x,d.y,a.x,a.y,b.x,b.y,e)},jB:function(a,b,c,d,e,f,g,h,k,l){function m(c,d){var e=(c-a)*(c-a)+(d-b)*(d-b);e<n&&(n=e,k.h(c,d))}var n=Infinity;m(k.x,k.y);var p=0,r=0,q=0,u=0;e<g?(p=e,r=g):(p=g,r=e);f<h?(q=e,u=g):(q=g,u=
e);p=(r-p)/2+l;l=(u-q)/2+l;e=(e+g)/2;f=(f+h)/2;if(0===p||0===l)return k;if(.5>(c>a?c-a:a-c)){p=1-(c-e)*(c-e)/(p*p);if(0>p)return k;p=Math.sqrt(p);d=-l*p+f;m(c,l*p+f);m(c,d)}else{c=(d-b)/(c-a);d=1/(p*p)+c*c/(l*l);h=2*c*(b-c*a)/(l*l)-2*c*f/(l*l)-2*e/(p*p);p=h*h-4*d*(2*c*a*f/(l*l)-2*b*f/(l*l)+f*f/(l*l)+e*e/(p*p)-1+(b-c*a)*(b-c*a)/(l*l));if(0>p)return k;p=Math.sqrt(p);l=(-h+p)/(2*d);m(l,c*l-c*a+b);p=(-h-p)/(2*d);m(p,c*p-c*a+b)}return k},Cf:function(a,b,c,d,e,f,g,h,k){var l=1E21,m=a,n=b;if(L.Le(a,b,a,
d,e,f,g,h,k)){var p=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f);p<l&&(l=p,m=k.x,n=k.y)}L.Le(c,b,c,d,e,f,g,h,k)&&(p=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),p<l&&(l=p,m=k.x,n=k.y));L.Le(a,b,c,b,e,f,g,h,k)&&(b=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),b<l&&(l=b,m=k.x,n=k.y));L.Le(a,d,c,d,e,f,g,h,k)&&(a=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),a<l&&(l=a,m=k.x,n=k.y));k.h(m,n);return 1E21>l},iB:function(a,b,c,d,e,f,g,h,k){c=a-c;g=e-g;0===c||0===g?0===c?(b=(f-h)/g,h=a,e=b*h+(f-b*e)):(f=(b-d)/c,h=e,e=f*h+(b-f*a)):(d=(b-d)/c,h=(f-h)/g,a=b-d*a,
h=(f-h*e-a)/(d-h),e=d*h+a);k.h(h,e);return k},ys:function(a,b,c){return L.$x(a.x,a.y,a.width,a.height,b.x,b.y,c.x,c.y)},$x:function(a,b,c,d,e,f,g,h){var k=a+c,l=b+d;return e===g?(f<h?(g=f,f=h):g=h,a<=e&&e<=k&&g<=l&&f>=b):f===h?(e<g?(h=e,e=g):h=g,b<=f&&f<=l&&h<=k&&e>=a):ac(a,b,c,d,e,f)||ac(a,b,c,d,g,h)||L.bm(a,b,k,b,e,f,g,h)||L.bm(k,b,k,l,e,f,g,h)||L.bm(k,l,a,l,e,f,g,h)||L.bm(a,l,a,b,e,f,g,h)?!0:!1},bm:function(a,b,c,d,e,f,g,h){return 0>=L.Vl(a,b,c,d,e,f)*L.Vl(a,b,c,d,g,h)&&0>=L.Vl(e,f,g,h,a,b)*L.Vl(e,
f,g,h,c,d)},Vl:function(a,b,c,d,e,f){c-=a;d-=b;a=e-a;b=f-b;f=a*d-b*c;0===f&&(f=a*c+b*d,0<f&&(f=(a-c)*c+(b-d)*d,0>f&&(f=0)));return f},iq:function(a){0>a&&(a+=360);360<=a&&(a-=360);return a},Fx:function(a,b,c,d,e,f){var g=Math.PI;f||(d*=g/180,e*=g/180);var h=d>e?-1:1;f=[];var k=g/2,l=d;d=Math.min(2*g,Math.abs(e-d));if(1E-5>d)return k=l+h*Math.min(d,k),h=a+c*Math.cos(l),l=b+c*Math.sin(l),a+=c*Math.cos(k),b+=c*Math.sin(k),c=(h+a)/2,k=(l+b)/2,f.push([h,l,c,k,c,k,a,b]),f;for(;1E-5<d;)e=l+h*Math.min(d,
k),f.push(L.rz(c,l,e,a,b)),d-=Math.abs(e-l),l=e;return f},rz:function(a,b,c,d,e){var f=(c-b)/2,g=a*Math.cos(f),h=a*Math.sin(f),k=-h,l=g*g+k*k,m=l+g*g+k*h;l=4/3*(Math.sqrt(2*l*m)-m)/(g*h-k*g);h=g-l*k;g=k+l*g;k=-g;l=f+b;f=Math.cos(l);l=Math.sin(l);return[d+a*Math.cos(b),e+a*Math.sin(b),d+h*f-g*l,e+h*l+g*f,d+h*f-k*l,e+h*l+k*f,d+a*Math.cos(c),e+a*Math.sin(c)]},Wp:function(a,b,c,d,e,f,g){c=Math.floor((a-c)/e)*e+c;d=Math.floor((b-d)/f)*f+d;var h=c;c+e-a<e/2&&(h=c+e);a=d;d+f-b<f/2&&(a=d+f);g.h(h,a);return g},
Qx:function(a,b){var c=Math.max(a,b);a=Math.min(a,b);var d;do b=c%a,c=d=a,a=b;while(0<b);return d},xz:function(a,b,c,d){var e=0>c,f=0>d;if(a<b){var g=1;var h=0}else g=0,h=1;var k=0===g?a:b;var l=0===g?c:d;if(0===g?e:f)l=-l;g=h;c=0===g?c:d;if(0===g?e:f)c=-c;return L.yz(k,0===g?a:b,l,c,0,0)},yz:function(a,b,c,d,e,f){if(0<d)if(0<c){e=a*a;f=b*b;a*=c;var g=b*d,h=-f+g,k=-f+Math.sqrt(a*a+g*g);b=h;for(var l=0;9999999999>l;++l){b=.5*(h+k);if(b===h||b===k)break;var m=a/(b+e),n=g/(b+f);m=m*m+n*n-1;if(0<m)h=
b;else if(0>m)k=b;else break}c=e*c/(b+e)-c;d=f*d/(b+f)-d;c=Math.sqrt(c*c+d*d)}else c=Math.abs(d-b);else d=a*a-b*b,f=a*c,f<d?(d=f/d,f=b*Math.sqrt(Math.abs(1-d*d)),c=a*d-c,c=Math.sqrt(c*c+f*f)):c=Math.abs(c-a);return c},Qe:new Xa,Gm:new Xa,Jf:new Xa,Kf:0,Hm:100};L.za=L.ZA;
function P(a){Ua(this);this.v=!1;void 0===a&&(a=P.o);this.ha=a;this.sc=this.ic=this.cd=this.bd=0;this.gj=new F;this.$q=this.gj.Da;this.Mq=(new M).freeze();this.qa=!0;this.Om=this.xk=null;this.Pm=NaN;this.mf=tc;this.nf=Bc;this.$k=this.al=NaN;this.Of=pd}
P.prototype.copy=function(){var a=new P;a.ha=this.ha;a.bd=this.bd;a.cd=this.cd;a.ic=this.ic;a.sc=this.sc;for(var b=this.gj.m,c=b.length,d=a.gj,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.$q=this.$q;a.Mq.assign(this.Mq);a.qa=this.qa;a.xk=this.xk;a.Om=this.Om;a.Pm=this.Pm;a.mf=this.mf.I();a.nf=this.nf.I();a.al=this.al;a.$k=this.$k;a.Of=this.Of;return a};P.prototype.ca=function(){this.freeze();Object.freeze(this);return this};
P.prototype.freeze=function(){this.v=!0;var a=this.figures;a.freeze();a=a.m;for(var b=a.length,c=0;c<b;c++)a[c].freeze();return this};P.prototype.ea=function(){Object.isFrozen(this)&&C("cannot thaw constant: "+this);this.v=!1;var a=this.figures;a.ea();a=a.m;for(var b=a.length,c=0;c<b;c++)a[c].ea();return this};
P.prototype.Ua=function(a){if(!(a instanceof P))return!1;if(this.type!==a.type)return this.type===P.j&&a.type===P.o?qd(this,a):a.type===P.j&&this.type===P.o?qd(a,this):!1;if(this.type===P.o){var b=this.figures.m;a=a.figures.m;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Ua(a[d]))return!1;return!0}return L.w(this.startX,a.startX)&&L.w(this.startY,a.startY)&&L.w(this.endX,a.endX)&&L.w(this.endY,a.endY)};
function qd(a,b){return a.type!==P.j||b.type!==P.o?!1:1===b.figures.count&&(b=b.figures.J(0),1===b.segments.count&&L.w(a.startX,b.startX)&&L.w(a.startY,b.startY)&&(b=b.segments.J(0),b.type===rd&&L.w(a.endX,b.endX)&&L.w(a.endY,b.endY)))?!0:!1}P.wa=function(a){return a.toString()};P.prototype.gb=function(a){a.classType===P&&(this.type=a)};
P.prototype.toString=function(a){void 0===a&&(a=-1);switch(this.type){case P.j:return 0>a?"M"+this.startX.toString()+" "+this.startY.toString()+"L"+this.endX.toString()+" "+this.endY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a)+"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);case P.D:var b=new M(this.startX,this.startY,0,0);b.Tv(this.endX,this.endY,0,0);return 0>a?"M"+b.x.toString()+" "+b.y.toString()+"H"+b.right.toString()+"V"+b.bottom.toString()+"H"+b.left.toString()+"z":"M"+
b.x.toFixed(a)+" "+b.y.toFixed(a)+"H"+b.right.toFixed(a)+"V"+b.bottom.toFixed(a)+"H"+b.left.toFixed(a)+"z";case P.L:b=new M(this.startX,this.startY,0,0);b.Tv(this.endX,this.endY,0,0);if(0>a)return a=b.left.toString()+" "+(b.y+b.height/2).toString(),"M"+a+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+(b.right.toString()+" "+(b.y+b.height/2).toString())+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+a;var c=b.left.toFixed(a)+" "+(b.y+b.height/2).toFixed(a);return"M"+
c+"A"+(b.width/2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+(b.right.toFixed(a)+" "+(b.y+b.height/2).toFixed(a))+"A"+(b.width/2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+c;case P.o:b="";c=this.figures.m;for(var d=c.length,e=0;e<d;e++){var f=c[e];0<e&&(b+=" x ");f.isFilled&&(b+="F ");b+=f.toString(a)}return b;default:return this.type.toString()}};
P.Ma=function(a){a=a.split(/[Xx]/);for(var b=a.length,c="",d=0;d<b;d++){var e=a[d];c=null!==e.match(/[Ff]/)?0===d?c+e:c+("X"+(" "===e[0]?"":" ")+e):c+((0===d?"":"X ")+"F"+(" "===e[0]?"":" ")+e)}return c};
P.parse=function(a,b){function c(){return u>=B-1?!0:null!==l[u+1].match(z)}function d(){u++;return l[u]}function e(a){var b=parseFloat(d()),c=parseFloat(d());w===w.toLowerCase()&&(b=y.x+b,c=y.y+c);a.h(b,c)}function f(){e(y);return y}function g(){e(A);return A}function h(){var a=v.toLowerCase();return"c"!==a&&"s"!==a&&"q"!==a&&"t"!==a?y:new J(2*y.x-A.x,2*y.y-A.y)}void 0===b&&(b=!1);var k=/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm;a=a.replace(/,/gm," ");a=a.replace(k,"$1 $2");
a=a.replace(k,"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([^s])/gm,"$1 $2");a=a.replace(/([^s])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([0-9])([+\-])/gm,"$1 $2");a=a.replace(/[\s\r\t\n]+/gm," ");a=a.replace(/^\s+|\s+$/g,"");var l=a.split(" ");for(a=0;a<l.length;a++){var m=l[a];if(null!==m.match(/(\.[0-9]*)(\.)/gm)){k=Ga();for(var n="",p=!1,r=0;r<m.length;r++){var q=m[r];"."!==q||p?"."===q?(k.push(n),n="."):n+=q:(p=!0,n+=q)}k.push(n);l.splice(a,1);for(m=0;m<k.length;m++)l.splice(a+
m,0,k[m]);a+=k.length-1;Ja(k)}}var u=-1,w="",v="";k=new J(0,0);var A=new J(0,0),y=new J(0,0),B=l.length;a=sd(null);n=m=!1;p=!0;r=null;for(var z=/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/;!(u>=B-1);)if(v=w,w=d(),""!==w)switch(w.toUpperCase()){case "X":p=!0;n=m=!1;break;case "M":r=f();null===a.jc||!0===p?(td(a,r.x,r.y,m,!n),p=!1):a.moveTo(r.x,r.y);for(k.assign(y);!c();)r=f(),a.lineTo(r.x,r.y);break;case "L":for(;!c();)r=f(),a.lineTo(r.x,r.y);break;case "H":for(;!c();)y=new J((w===w.toLowerCase()?y.x:0)+parseFloat(d()),
y.y),a.lineTo(y.x,y.y);break;case "V":for(;!c();)y=new J(y.x,(w===w.toLowerCase()?y.y:0)+parseFloat(d())),a.lineTo(y.x,y.y);break;case "C":for(;!c();){r=new J;e(r);q=g();var E=f();yd(a,r.x,r.y,q.x,q.y,E.x,E.y)}break;case "S":for(;!c();)r=h(),q=g(),E=f(),yd(a,r.x,r.y,q.x,q.y,E.x,E.y);break;case "Q":for(;!c();)r=g(),q=f(),zd(a,r.x,r.y,q.x,q.y);break;case "T":for(;!c();)A=r=h(),q=f(),zd(a,r.x,r.y,q.x,q.y);break;case "B":for(;!c();){r=parseFloat(d());q=parseFloat(d());E=parseFloat(d());var K=parseFloat(d()),
O=parseFloat(d()),S=O,Q=!1;c()||(S=parseFloat(d()),c()||(Q=0!==parseFloat(d())));w===w.toLowerCase()&&(E+=y.x,K+=y.y);a.arcTo(r,q,E,K,O,S,Q)}break;case "A":for(;!c();)r=Math.abs(parseFloat(d())),q=Math.abs(parseFloat(d())),E=parseFloat(d()),O=K=!1,Q=S=0,S=d(),1===S.length?(K=!!parseFloat(S),O=!!parseFloat(d()),S=parseFloat(d())):2===S.length?(K=!!parseFloat(S[0]),O=!!parseFloat(S[1]),S=parseFloat(d())):(K=!!parseFloat(S[0]),O=!!parseFloat(S[1]),S=parseFloat(S.slice(2))),Q=parseFloat(d()),w===w.toLowerCase()&&
(S=y.x+S,Q=y.y+Q),y.h(S,Q),Ad(a,r,q,E,K,O,S,Q);break;case "Z":Bd(a);y.assign(k);break;case "F":r="";for(q=1;l[u+q];)if(null!==l[u+q].match(/[Uu]/))q++;else if(null===l[u+q].match(z))q++;else{r=l[u+q];break}r.match(/[Mm]/)?m=!0:0<a.jc.segments.length&&(a.jc.isFilled=!0);break;case "U":r="";for(q=1;l[u+q];)if(null!==l[u+q].match(/[Ff]/))q++;else if(null===l[u+q].match(z))q++;else{r=l[u+q];break}r.match(/[Mm]/)?n=!0:a.zm(!1)}k=a.ss;Cd=a;if(b)for(b=k.figures.iterator;b.next();)b.value.isFilled=!0;return k};
P.Ba=function(a,b){for(var c=a.length,d=J.alloc(),e=0;e<c;e++){var f=a[e];d.x=f[0];d.y=f[1];b.Aa(d);f[0]=d.x;f[1]=d.y;d.x=f[2];d.y=f[3];b.Aa(d);f[2]=d.x;f[3]=d.y;d.x=f[4];d.y=f[5];b.Aa(d);f[4]=d.x;f[5]=d.y;d.x=f[6];d.y=f[7];b.Aa(d);f[6]=d.x;f[7]=d.y}J.free(d)};P.prototype.ev=function(){if(this.qa||this.$q!==this.figures.Da)return!0;for(var a=this.figures.m,b=a.length,c=0;c<b;c++)if(a[c].ev())return!0;return!1};
P.prototype.computeBounds=function(){this.qa=!1;this.Om=this.xk=null;this.Pm=NaN;this.$q=this.figures.Da;for(var a=this.figures.m,b=a.length,c=0;c<b;c++){var d=a[c];d.qa=!1;var e=d.segments;d.Or=e.Da;d=e.m;e=d.length;for(var f=0;f<e;f++){var g=d[f];g.qa=!1;g.Rd=null}}a=this.Mq;a.ea();isNaN(this.al)||isNaN(this.$k)?a.h(0,0,0,0):a.h(0,0,this.al,this.$k);Dd(this,a,!1);$b(a,0,0,0,0);a.freeze()};P.prototype.Ex=function(){var a=new M;Dd(this,a,!0);return a};
function Dd(a,b,c){switch(a.type){case P.j:case P.D:case P.L:c?b.h(a.bd,a.cd,0,0):$b(b,a.bd,a.cd,0,0);$b(b,a.ic,a.sc,0,0);break;case P.o:var d=a.figures;a=d.m;d=d.length;for(var e=0;e<d;e++){var f=a[e];c&&0===e?b.h(f.startX,f.startY,0,0):$b(b,f.startX,f.startY,0,0);for(var g=f.segments.m,h=g.length,k=f.startX,l=f.startY,m=0;m<h;m++){var n=g[m];switch(n.type){case rd:case Pd:k=n.endX;l=n.endY;$b(b,k,l,0,0);break;case Qd:L.Tl(k,l,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.5,b);k=n.endX;
l=n.endY;break;case Rd:L.tv(k,l,n.point1X,n.point1Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;break;case Sd:case Td:var p=n.type===Sd?Ud(n,f):Vd(n,f,k,l),r=p.length;if(0===r){k=n.type===Sd?n.centerX:n.endX;l=n.type===Sd?n.centerY:n.endY;$b(b,k,l,0,0);break}n=null;for(var q=0;q<r;q++)n=p[q],L.Tl(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.5,b);null!==n&&(k=n[6],l=n[7]);break;default:C("Unknown Segment type: "+n.type)}}}break;default:C("Unknown Geometry type: "+a.type)}}
P.prototype.normalize=function(){this.v&&wa(this);var a=this.Ex();this.offset(-a.x,-a.y);return new J(-a.x,-a.y)};P.prototype.offset=function(a,b){this.v&&wa(this);this.transform(1,0,0,1,a,b);return this};P.prototype.scale=function(a,b){this.v&&wa(this);this.transform(a,0,0,b,0,0);return this};P.prototype.rotate=function(a,b,c){this.v&&wa(this);void 0===b&&(b=0);void 0===c&&(c=0);var d=nd.alloc();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);nd.free(d);return this};
t=P.prototype;
t.transform=function(a,b,c,d,e,f){switch(this.type){case P.j:case P.D:case P.L:var g=this.bd;var h=this.cd;this.bd=g*a+h*c+e;this.cd=g*b+h*d+f;g=this.ic;h=this.sc;this.ic=g*a+h*c+e;this.sc=g*b+h*d+f;break;case P.o:for(var k=this.figures.m,l=k.length,m=0;m<l;m++){var n=k[m];g=n.startX;h=n.startY;n.startX=g*a+h*c+e;n.startY=g*b+h*d+f;n=n.segments.m;for(var p=n.length,r=0;r<p;r++){var q=n[r];switch(q.type){case rd:case Pd:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Qd:g=q.point1X;
h=q.point1Y;q.point1X=g*a+h*c+e;q.point1Y=g*b+h*d+f;g=q.point2X;h=q.point2Y;q.point2X=g*a+h*c+e;q.point2Y=g*b+h*d+f;g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Rd:g=q.point1X;h=q.point1Y;q.point1X=g*a+h*c+e;q.point1Y=g*b+h*d+f;g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Sd:g=q.centerX;h=q.centerY;q.centerX=g*a+h*c+e;q.centerY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),q.startAngle+=g);0>a&&(q.startAngle=180-q.startAngle,q.sweepAngle=-q.sweepAngle);
0>d&&(q.startAngle=-q.startAngle,q.sweepAngle=-q.sweepAngle);q.radiusX*=Math.sqrt(a*a+c*c);void 0!==q.radiusY&&(q.radiusY*=Math.sqrt(b*b+d*d));break;case Td:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;if(0===q.radiusX||0===q.radiusY)break;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),q.xAxisRotation+=g);0>a&&(q.xAxisRotation=180-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);0>d&&(q.xAxisRotation=-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);q.radiusX*=Math.sqrt(a*a+c*c);
q.radiusY*=Math.sqrt(b*b+d*d);break;default:C("Unknown Segment type: "+q.type)}}}}this.qa=!0;return this};
t.$=function(a,b){void 0===b&&(b=0);var c=this.bd,d=this.cd,e=this.ic,f=this.sc;switch(this.type){case P.j:return L.Nb(c,d,e,f,b,a.x,a.y);case P.D:var g=M.allocAt(Math.min(c,e)-b,Math.min(d,f)-b,Math.abs(e-c)+2*b,Math.abs(f-d)+2*b);a=g.$(a);M.free(g);return a;case P.L:g=Math.min(c,e)-b;var h=Math.min(d,f)-b;c=(Math.abs(e-c)+2*b)/2;b=(Math.abs(f-d)+2*b)/2;if(0>=c||0>=b)return!1;g=a.x-(g+c);h=a.y-(h+b);return 1>=g*g/(c*c)+h*h/(b*b);case P.o:return Wd(this,a,b,!0,!1);default:return!1}};
function Wd(a,b,c,d,e){var f=b.x;b=b.y;for(var g=a.bounds.x-20,h=0,k,l,m,n,p=a.figures.m,r=p.length,q=0;q<r;q++){var u=p[q];if(u.isFilled){if(d&&u.$(f,b,c))return!0;var w=u.segments;k=u.startX;l=u.startY;for(var v=k,A=l,y=w.m,B=0;B<=w.length;B++){var z=void 0;if(B!==w.length){z=y[B];var E=z.type;a=z.endX;n=z.endY}else E=rd,a=v,n=A;switch(E){case Pd:v=Xd(f,b,g,b,k,l,v,A);if(isNaN(v))return!0;h+=v;v=a;A=n;break;case rd:k=Xd(f,b,g,b,k,l,a,n);if(isNaN(k))return!0;h+=k;break;case Qd:m=L.Op(k,l,z.point1X,
z.point1Y,z.point2X,z.point2Y,a,n,g,b,f,b,.5);h+=m;break;case Rd:m=L.Op(k,l,(k+2*z.point1X)/3,(l+2*z.point1Y)/3,(2*z.point1X+a)/3,(2*z.point1Y+n)/3,a,n,g,b,f,b,.5);h+=m;break;case Sd:case Td:E=z.type===Sd?Ud(z,u):Vd(z,u,k,l);var K=E.length;if(0===K){k=Xd(f,b,g,b,k,l,z.type===Sd?z.centerX:z.endX,z.type===Sd?z.centerY:z.endY);if(isNaN(k))return!0;h+=k;break}z=null;for(var O=0;O<K;O++){z=E[O];if(0===O){m=Xd(f,b,g,b,k,l,z[0],z[1]);if(isNaN(m))return!0;h+=m}m=L.Op(z[0],z[1],z[2],z[3],z[4],z[5],z[6],z[7],
g,b,f,b,.5);h+=m}null!==z&&(a=z[6],n=z[7]);break;default:C("Unknown Segment type: "+z.type)}k=a;l=n}if(0!==h)return!0;h=0}else if(u.$(f,b,e?c:c+2))return!0}return 0!==h}
function Xd(a,b,c,d,e,f,g,h){if(L.Nb(e,f,g,h,.05,a,b))return NaN;var k=(a-c)*(f-h);if(0===k)return 0;var l=((a*d-b*c)*(e-g)-(a-c)*(e*h-f*g))/k;b=(a*d-b*c)*(f-h)/k;if(l>=a)return 0;if((e>g?e-g:g-e)<(f>h?f-h:h-f))if(f<h){if(b<f||b>h)return 0}else{if(b<h||b>f)return 0}else if(e<g){if(l<e||l>g)return 0}else if(l<g||l>e)return 0;return 0<k?1:-1}function Yd(a,b,c,d){a=a.figures.m;for(var e=a.length,f=0;f<e;f++)if(a[f].$(b,c,d))return!0;return!1}
t.Tu=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new J);if(this.type===P.j)return b.h(this.startX+a*(this.endX-this.startX),this.startY+a*(this.endY-this.startY)),b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=f-g,d=0===m?0:d/m,c=c[h],h=c[2*a],e=c[2*a+1],b.h(h+(c[2*a+2]-h)*d,e+(c[2*a+3]-e)*d),b;g+=m}}return b};
t.Rx=function(a){0>a?a=0:1<a&&(a=1);if(this.type===P.j)return 180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI;for(var b=this.flattenedSegments,c=this.flattenedLengths,d=b.length,e=this.flattenedTotalLength*a,f=0,g=0;g<d;g++){var h=c[g],k=h.length;for(a=0;a<k;a++){var l=h[a];if(f+l>=e)return e=b[g],b=e[2*a],c=e[2*a+1],d=e[2*a+2],a=e[2*a+3],1>Math.abs(d-b)&&1>Math.abs(a-c)?0:1>Math.abs(d-b)?0<=a-c?90:270:1>Math.abs(a-c)?0<=d-b?0:180:180*Math.atan2(a-c,d-b)/Math.PI;f+=l}}return NaN};
t.Uu=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=[]);b.length=3;if(this.type===P.j)return b[0]=this.startX+a*(this.endX-this.startX),b[1]=this.startY+a*(this.endY-this.startY),b[2]=180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI,b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=f-g,d=0===m?0:d/m,m=c[h],c=m[2*a],h=m[2*a+1],e=m[2*a+2],a=m[2*
a+3],b[0]=c+(e-c)*d,b[1]=h+(a-h)*d,b[2]=1>Math.abs(e-c)&&1>Math.abs(a-h)?0:1>Math.abs(e-c)?0<=a-h?90:270:1>Math.abs(a-h)?0<=e-c?0:180:180*Math.atan2(a-h,e-c)/Math.PI,b;g+=m}}return b};
t.Sx=function(a){if(this.type===P.j){var b=this.startX,c=this.startY,d=this.endX,e=this.endY;if(b!==d||c!==e){var f=a.x;a=a.y;if(b===d){if(c<e){var g=c;d=e}else g=e,d=c;return a<=g?g===c?0:1:a>=d?d===c?0:1:Math.abs(a-c)/(d-g)}if(c===e)return b<d?g=b:(g=d,d=b),f<=g?g===b?0:1:f>=d?d===b?0:1:Math.abs(f-b)/(d-g);g=(d-b)*(d-b)+(e-c)*(e-c);var h=J.alloc();L.Ih(b,c,d,e,f,a,h);a=h.x;f=h.y;J.free(h);return Math.sqrt(((a-b)*(a-b)+(f-c)*(f-c))/g)}}else if(this.type===P.D){g=this.startX;h=this.startY;var k=this.endX;
e=this.endY;if(g!==k||h!==e){b=k-g;c=e-h;f=2*b+2*c;d=a.x;a=a.y;d=Math.min(Math.max(d,g),k);a=Math.min(Math.max(a,h),e);g=Math.abs(d-g);k=Math.abs(d-k);h=Math.abs(a-h);e=Math.abs(a-e);var l=Math.min(g,k,h,e);if(l===h)return d/f;if(l===k)return(b+a)/f;if(l===e)return(2*b+c-d)/f;if(l===g)return(2*b+2*c-a)/f}}else{b=this.flattenedSegments;c=this.flattenedLengths;f=this.flattenedTotalLength;d=J.alloc();e=Infinity;h=g=0;k=b.length;for(var m=l=0,n=0;n<k;n++)for(var p=b[n],r=c[n],q=p.length,u=0;u<q;u+=2){var w=
p[u],v=p[u+1];if(0!==u){L.Ih(l,m,w,v,a.x,a.y,d);var A=(d.x-a.x)*(d.x-a.x)+(d.y-a.y)*(d.y-a.y);A<e&&(e=A,g=h,g+=Math.sqrt((d.x-l)*(d.x-l)+(d.y-m)*(d.y-m)));h+=r[(u-2)/2]}l=w;m=v}J.free(d);a=g/f;return 0>a?0:1<a?1:a}return 0};
function Zd(a){if(null===a.xk){var b=a.xk=[],c=a.Om=[],d=[],e=[];if(a.type===P.j)d.push(a.startX),d.push(a.startY),d.push(a.endX),d.push(a.endY),b.push(d),e.push(Math.sqrt((a.startX-a.endX)*(a.startX-a.endX)+(a.startY-a.endY)*(a.startY-a.endY))),c.push(e);else if(a.type===P.D)d.push(a.startX),d.push(a.startY),d.push(a.endX),d.push(a.startY),d.push(a.endX),d.push(a.endY),d.push(a.startX),d.push(a.endY),d.push(a.startX),d.push(a.startY),b.push(d),e.push(Math.abs(a.startX-a.endX)),e.push(Math.abs(a.startY-
a.endY)),e.push(Math.abs(a.startX-a.endX)),e.push(Math.abs(a.startY-a.endY)),c.push(e);else if(a.type===P.L){var f=new $d;f.startX=a.endX;f.startY=(a.startY+a.endY)/2;var g=new ae(Sd);g.startAngle=0;g.sweepAngle=360;g.centerX=(a.startX+a.endX)/2;g.centerY=(a.startY+a.endY)/2;g.radiusX=Math.abs(a.startX-a.endX)/2;g.radiusY=Math.abs(a.startY-a.endY)/2;f.add(g);a=Ud(g,f);e=a.length;if(0===e)d.push(g.centerX),d.push(g.centerY);else{g=f.startX;f=f.startY;for(var h=0;h<e;h++){var k=a[h];L.Fe(g,f,k[2],k[3],
k[4],k[5],k[6],k[7],.5,d);g=k[6];f=k[7]}}b.push(d);c.push(be(d))}else for(a=a.figures.iterator;a.next();){e=a.value;d=[];d.push(e.startX);d.push(e.startY);g=e.startX;f=e.startY;h=g;k=f;for(var l=e.segments.m,m=l.length,n=0;n<m;n++){var p=l[n];switch(p.type){case Pd:4<=d.length&&(b.push(d),c.push(be(d)));d=[];d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;h=g;k=f;break;case rd:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case Qd:L.Fe(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,
.5,d);g=p.endX;f=p.endY;break;case Rd:L.kq(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case Sd:var r=Ud(p,e),q=r.length;if(0===q){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(var u=0;u<q;u++){var w=r[u];L.Fe(g,f,w[2],w[3],w[4],w[5],w[6],w[7],.5,d);g=w[6];f=w[7]}break;case Td:r=Vd(p,e,g,f);q=r.length;u=p.endX;w=p.endY;if(0===q){d.push(u);d.push(w);g=u;f=w;break}for(u=0;u<q;u++)w=r[u],L.Fe(g,f,w[2],w[3],w[4],w[5],w[6],w[7],.5,d),g=w[6],f=w[7];break;default:C("Segment not of valid type: "+
p.type)}p.isClosed&&(d.push(h),d.push(k))}4<=d.length&&(b.push(d),c.push(be(d)))}}}function be(a){for(var b=[],c=0,d=0,e=a.length,f=0;f<e;f+=2){var g=a[f],h=a[f+1];0!==f&&b.push(Math.sqrt(Ab(c,d,g,h)));c=g;d=h}return b}t.add=function(a){this.gj.add(a);return this};t.Am=function(a,b,c,d,e,f,g,h){this.v&&wa(this);this.mf=(new N(a,b,e,f)).freeze();this.nf=(new N(c,d,g,h)).freeze();return this};
na.Object.defineProperties(P.prototype,{flattenedSegments:{get:function(){Zd(this);return this.xk}},flattenedLengths:{get:function(){Zd(this);return this.Om}},flattenedTotalLength:{get:function(){var a=this.Pm;if(isNaN(a)){if(this.type===P.j){a=Math.abs(this.endX-this.startX);var b=Math.abs(this.endY-this.startY);a=Math.sqrt(a*a+b*b)}else if(this.type===P.D)a=2*Math.abs(this.endX-this.startX)+2*Math.abs(this.endY-
this.startY);else{b=this.flattenedLengths;for(var c=b.length,d=a=0;d<c;d++)for(var e=b[d],f=e.length,g=0;g<f;g++)a+=e[g]}this.Pm=a}return a}},type:{get:function(){return this.ha},set:function(a){this.ha!==a&&(this.v&&wa(this,a),this.ha=a,this.qa=!0)}},startX:{get:function(){return this.bd},set:function(a){this.bd!==a&&(this.v&&wa(this,a),this.bd=a,this.qa=!0)}},startY:{get:function(){return this.cd},set:function(a){this.cd!==
a&&(this.v&&wa(this,a),this.cd=a,this.qa=!0)}},endX:{get:function(){return this.ic},set:function(a){this.ic!==a&&(this.v&&wa(this,a),this.ic=a,this.qa=!0)}},endY:{get:function(){return this.sc},set:function(a){this.sc!==a&&(this.v&&wa(this,a),this.sc=a,this.qa=!0)}},figures:{get:function(){return this.gj},set:function(a){this.gj!==a&&(this.v&&wa(this,a),this.gj=a,this.qa=!0)}},spot1:{
get:function(){return this.mf},set:function(a){this.v&&wa(this,a);this.mf=a.I()}},spot2:{get:function(){return this.nf},set:function(a){this.v&&wa(this,a);this.nf=a.I()}},defaultStretch:{get:function(){return this.Of},set:function(a){this.v&&wa(this,a);this.Of=a}},bounds:{get:function(){this.ev()&&this.computeBounds();return this.Mq}}});P.prototype.setSpots=P.prototype.Am;P.prototype.add=P.prototype.add;
P.prototype.getFractionForPoint=P.prototype.Sx;P.prototype.getPointAndAngleAlongPath=P.prototype.Uu;P.prototype.getAngleAlongPath=P.prototype.Rx;P.prototype.getPointAlongPath=P.prototype.Tu;P.prototype.containsPoint=P.prototype.$;P.prototype.transform=P.prototype.transform;P.prototype.rotate=P.prototype.rotate;P.prototype.scale=P.prototype.scale;P.prototype.offset=P.prototype.offset;P.prototype.normalize=P.prototype.normalize;P.prototype.computeBoundsWithoutOrigin=P.prototype.Ex;
P.prototype.equalsApprox=P.prototype.Ua;P.className="Geometry";P.j=new D(P,"Line",0);P.D=new D(P,"Rectangle",1);P.L=new D(P,"Ellipse",2);P.o=new D(P,"Path",3);P.Qb="UuBbMmZzLlHhVvCcSsQqTtAaFfXx";P.className="Geometry";P.stringify=P.wa;P.fillPath=P.Ma;P.parse=P.parse;P.Line=P.j;P.Rectangle=P.D;P.Ellipse=P.L;P.Path=P.o;
function $d(a,b,c,d){Ua(this);this.Ew=null;this.v=!1;void 0===c&&(c=!0);this.jr=c;void 0===d&&(d=!0);this.pr=d;void 0!==a?this.bd=a:this.bd=0;void 0!==b?this.cd=b:this.cd=0;this.Cl=new F;this.Or=this.Cl.Da;this.qa=!0}$d.prototype.copy=function(){var a=new $d;a.jr=this.jr;a.pr=this.pr;a.bd=this.bd;a.cd=this.cd;for(var b=this.Cl.m,c=b.length,d=a.Cl,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.Or=this.Or;a.qa=this.qa;a.Ew=this.Ew;return a};t=$d.prototype;
t.Ua=function(a){if(!(a instanceof $d&&L.w(this.startX,a.startX)&&L.w(this.startY,a.startY)))return!1;var b=this.segments.m;a=a.segments.m;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Ua(a[d]))return!1;return!0};t.toString=function(a){void 0===a&&(a=-1);var b=0>a?"M"+this.startX.toString()+" "+this.startY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a);for(var c=this.segments.m,d=c.length,e=0;e<d;e++)b+=" "+c[e].toString(a);return b};
t.freeze=function(){this.v=!0;var a=this.segments;a.freeze();var b=a.m;a=a.length;for(var c=0;c<a;c++)b[c].freeze();return this};t.ea=function(){this.v=!1;var a=this.segments;a.ea();a=a.m;for(var b=a.length,c=0;c<b;c++)a[c].ea();return this};t.ev=function(){if(this.qa)return!0;var a=this.segments;if(this.Or!==a.Da)return!0;a=a.m;for(var b=a.length,c=0;c<b;c++)if(a[c].qa)return!0;return!1};t.add=function(a){this.Cl.add(a);return this};
t.$=function(a,b,c){for(var d=this.startX,e=this.startY,f=d,g=e,h=this.segments.m,k=h.length,l=0;l<k;l++){var m=h[l];switch(m.type){case Pd:f=m.endX;g=m.endY;d=m.endX;e=m.endY;break;case rd:if(L.Nb(d,e,m.endX,m.endY,c,a,b))return!0;d=m.endX;e=m.endY;break;case Qd:if(L.hs(d,e,m.point1X,m.point1Y,m.point2X,m.point2Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case Rd:if(L.uv(d,e,m.point1X,m.point1Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case Sd:case Td:var n=m.type===
Sd?Ud(m,this):Vd(m,this,d,e),p=n.length,r=m.type===Sd?m.centerX:m.endX,q=m.type===Sd?m.centerY:m.endY;if(0===p){if(L.Nb(d,e,r,q,c,a,b))return!0;d=r;e=q;break}r=null;for(q=0;q<p;q++)if(r=n[q],0===q&&L.Nb(d,e,r[0],r[1],c,a,b)||L.hs(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],.5,a,b,c))return!0;null!==r&&(d=r[6],e=r[7]);break;default:C("Unknown Segment type: "+m.type)}if(m.isClosed&&(d!==f||e!==g)&&L.Nb(d,e,f,g,c,a,b))return!0}return!1};
na.Object.defineProperties($d.prototype,{isFilled:{get:function(){return this.jr},set:function(a){this.v&&wa(this,a);this.jr=a}},isShadowed:{get:function(){return this.pr},set:function(a){this.v&&wa(this,a);this.pr=a}},startX:{get:function(){return this.bd},set:function(a){this.v&&wa(this,a);this.bd=a;this.qa=!0}},startY:{get:function(){return this.cd},set:function(a){this.v&&wa(this,
a);this.cd=a;this.qa=!0}},segments:{get:function(){return this.Cl},set:function(a){this.v&&wa(this,a);this.Cl=a;this.qa=!0}}});$d.prototype.add=$d.prototype.add;$d.prototype.equalsApprox=$d.prototype.Ua;$d.className="PathFigure";
function ae(a,b,c,d,e,f,g,h){Ua(this);this.v=!1;void 0===a&&(a=rd);this.ha=a;void 0!==b?this.ic=b:this.ic=0;void 0!==c?this.sc=c:this.sc=0;void 0===d&&(d=0);void 0===e&&(e=0);void 0===f&&(f=0);void 0===g&&(g=0);a===Td?(a=f%360,0>a&&(a+=360),this.De=a,this.pi=0,this.ri=Math.max(d,0),this.fh=Math.max(e,0),this.hl="boolean"===typeof g?g:"number"===typeof g?!!g:!1,this.Dk=!!h):(this.De=d,this.pi=e,a===Sd&&(f=Math.max(f,0)),this.ri=f,"number"===typeof g?(a===Sd&&(g=Math.max(g,0)),this.fh=g):this.fh=0,
this.Dk=this.hl=!1);this.mj=!1;this.qa=!0;this.Rd=null}ae.prototype.copy=function(){var a=new ae;a.ha=this.ha;a.ic=this.ic;a.sc=this.sc;a.De=this.De;a.pi=this.pi;a.ri=this.ri;a.fh=this.fh;a.hl=this.hl;a.Dk=this.Dk;a.mj=this.mj;a.qa=this.qa;return a};t=ae.prototype;
t.Ua=function(a){if(!(a instanceof ae)||this.type!==a.type||this.isClosed!==a.isClosed)return!1;switch(this.type){case Pd:case rd:return L.w(this.endX,a.endX)&&L.w(this.endY,a.endY);case Qd:return L.w(this.endX,a.endX)&&L.w(this.endY,a.endY)&&L.w(this.point1X,a.point1X)&&L.w(this.point1Y,a.point1Y)&&L.w(this.point2X,a.point2X)&&L.w(this.point2Y,a.point2Y);case Rd:return L.w(this.endX,a.endX)&&L.w(this.endY,a.endY)&&L.w(this.point1X,a.point1X)&&L.w(this.point1Y,a.point1Y);case Sd:return L.w(this.startAngle,
a.startAngle)&&L.w(this.sweepAngle,a.sweepAngle)&&L.w(this.centerX,a.centerX)&&L.w(this.centerY,a.centerY)&&L.w(this.radiusX,a.radiusX)&&L.w(this.radiusY,a.radiusY);case Td:return this.isClockwiseArc===a.isClockwiseArc&&this.isLargeArc===a.isLargeArc&&L.w(this.xAxisRotation,a.xAxisRotation)&&L.w(this.endX,a.endX)&&L.w(this.endY,a.endY)&&L.w(this.radiusX,a.radiusX)&&L.w(this.radiusY,a.radiusY);default:return!1}};t.gb=function(a){a.classType===ae&&(this.type=a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Pd:a=0>a?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case rd:a=0>a?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Qd:a=0>a?"C"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.point2X.toString()+" "+this.point2Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"C"+this.point1X.toFixed(a)+
" "+this.point1Y.toFixed(a)+" "+this.point2X.toFixed(a)+" "+this.point2Y.toFixed(a)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Rd:a=0>a?"Q"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"Q"+this.point1X.toFixed(a)+" "+this.point1Y.toFixed(a)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Sd:a=0>a?"B"+this.startAngle.toString()+" "+this.sweepAngle.toString()+" "+this.centerX.toString()+" "+this.centerY.toString()+
" "+this.radiusX.toString()+" "+this.radiusY.toString():"B"+this.startAngle.toFixed(a)+" "+this.sweepAngle.toFixed(a)+" "+this.centerX.toFixed(a)+" "+this.centerY.toFixed(a)+" "+this.radiusX.toFixed(a)+" "+this.radiusY.toFixed(a);break;case Td:a=0>a?"A"+this.radiusX.toString()+" "+this.radiusY.toString()+" "+this.xAxisRotation.toString()+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toString()+" "+this.endY.toString():"A"+this.radiusX.toFixed(a)+" "+this.radiusY.toFixed(a)+
" "+this.xAxisRotation.toFixed(a)+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;default:a=this.type.toString()}return a+(this.mj?"z":"")};t.freeze=function(){this.v=!0;return this};t.ea=function(){this.v=!1;return this};t.close=function(){this.mj=!0;return this};
function Ud(a,b){if(null!==a.Rd&&!1===b.qa)return a.Rd;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.Rd=[],a.Rd;b=a.De;var e=a.pi,f=L.Fx(0,0,c<d?c:d,a.startAngle,a.startAngle+a.sweepAngle,!1);if(c!==d){var g=nd.alloc();g.reset();c<d?g.scale(1,d/c):g.scale(c/d,1);P.Ba(f,g);nd.free(g)}c=f.length;for(d=0;d<c;d++)g=f[d],g[0]+=b,g[1]+=e,g[2]+=b,g[3]+=e,g[4]+=b,g[5]+=e,g[6]+=b,g[7]+=e;a.Rd=f;return a.Rd}
function Vd(a,b,c,d){function e(a,b,c,d){return(a*d<b*c?-1:1)*Math.acos((a*c+b*d)/(Math.sqrt(a*a+b*b)*Math.sqrt(c*c+d*d)))}if(null!==a.Rd&&!1===b.qa)return a.Rd;if(0===a.radiusX||0===a.radiusY)return a.Rd=[],a.Rd;b=a.ri;var f=a.fh;0===b&&(b=1E-4);0===f&&(f=1E-4);var g=Math.PI/180*a.De,h=a.hl,k=a.Dk,l=a.ic,m=a.sc,n=Math.cos(g),p=Math.sin(g),r=n*(c-l)/2+p*(d-m)/2;g=-p*(c-l)/2+n*(d-m)/2;var q=r*r/(b*b)+g*g/(f*f);1<q&&(b*=Math.sqrt(q),f*=Math.sqrt(q));q=(h===k?-1:1)*Math.sqrt((b*b*f*f-b*b*g*g-f*f*r*r)/
(b*b*g*g+f*f*r*r));isNaN(q)&&(q=0);h=q*b*g/f;q=q*-f*r/b;isNaN(h)&&(h=0);isNaN(q)&&(q=0);c=(c+l)/2+n*h-p*q;d=(d+m)/2+p*h+n*q;m=e(1,0,(r-h)/b,(g-q)/f);n=(r-h)/b;l=(g-q)/f;r=(-r-h)/b;h=(-g-q)/f;g=e(n,l,r,h);r=(n*r+l*h)/(Math.sqrt(n*n+l*l)*Math.sqrt(r*r+h*h));-1>=r?g=Math.PI:1<=r&&(g=0);!k&&0<g&&(g-=2*Math.PI);k&&0>g&&(g+=2*Math.PI);k=b>f?1:b/f;r=b>f?f/b:1;b=L.Fx(0,0,b>f?b:f,m,m+g,!0);f=nd.alloc();f.reset();f.translate(c,d);f.rotate(a.De,0,0);f.scale(k,r);P.Ba(b,f);nd.free(f);a.Rd=b;return a.Rd}
na.Object.defineProperties(ae.prototype,{isClosed:{get:function(){return this.mj},set:function(a){this.mj!==a&&(this.mj=a,this.qa=!0)}},type:{get:function(){return this.ha},set:function(a){this.v&&wa(this,a);this.ha=a;this.qa=!0}},endX:{get:function(){return this.ic},set:function(a){this.v&&wa(this,a);this.ic=a;this.qa=!0}},endY:{get:function(){return this.sc},set:function(a){this.v&&
wa(this,a);this.sc=a;this.qa=!0}},point1X:{get:function(){return this.De},set:function(a){this.v&&wa(this,a);this.De=a;this.qa=!0}},point1Y:{get:function(){return this.pi},set:function(a){this.v&&wa(this,a);this.pi=a;this.qa=!0}},point2X:{get:function(){return this.ri},set:function(a){this.v&&wa(this,a);this.ri=a;this.qa=!0}},point2Y:{get:function(){return this.fh},set:function(a){this.v&&
wa(this,a);this.fh=a;this.qa=!0}},centerX:{get:function(){return this.De},set:function(a){this.v&&wa(this,a);this.De=a;this.qa=!0}},centerY:{get:function(){return this.pi},set:function(a){this.v&&wa(this,a);this.pi=a;this.qa=!0}},radiusX:{get:function(){return this.ri},set:function(a){0>a&&xa(a,">= zero",ae,"radiusX");this.v&&wa(this,a);this.ri=a;this.qa=!0}},radiusY:{get:function(){return this.fh},
set:function(a){0>a&&xa(a,">= zero",ae,"radiusY");this.v&&wa(this,a);this.fh=a;this.qa=!0}},startAngle:{get:function(){return this.ic},set:function(a){this.ic!==a&&(this.v&&wa(this,a),a%=360,0>a&&(a+=360),this.ic=a,this.qa=!0)}},sweepAngle:{get:function(){return this.sc},set:function(a){this.v&&wa(this,a);360<a&&(a=360);-360>a&&(a=-360);this.sc=a;this.qa=!0}},isClockwiseArc:{get:function(){return this.Dk},set:function(a){this.v&&
wa(this,a);this.Dk=a;this.qa=!0}},isLargeArc:{get:function(){return this.hl},set:function(a){this.v&&wa(this,a);this.hl=a;this.qa=!0}},xAxisRotation:{get:function(){return this.De},set:function(a){a%=360;0>a&&(a+=360);this.v&&wa(this,a);this.De=a;this.qa=!0}}});ae.prototype.equalsApprox=ae.prototype.Ua;
var Pd=new D(ae,"Move",0),rd=new D(ae,"Line",1),Qd=new D(ae,"Bezier",2),Rd=new D(ae,"QuadraticBezier",3),Sd=new D(ae,"Arc",4),Td=new D(ae,"SvgArc",4);ae.className="PathSegment";ae.Move=Pd;ae.Line=rd;ae.Bezier=Qd;ae.QuadraticBezier=Rd;ae.Arc=Sd;ae.SvgArc=Td;function ce(){this.C=null;this.ou=(new J(0,0)).freeze();this.yt=(new J(0,0)).freeze();this.Fq=this.yr=0;this.Gq=1;this.di="";this.ds=this.Uq=!1;this.Sq=this.Iq=0;this.xg=this.gr=this.mr=!1;this.Yq=null;this.bs=0;this.pd=this.$r=null}
ce.prototype.copy=function(){var a=new ce;return this.clone(a)};ce.prototype.clone=function(a){a.C=this.C;a.ou.assign(this.viewPoint);a.yt.assign(this.documentPoint);a.yr=this.yr;a.Fq=this.Fq;a.Gq=this.Gq;a.di=this.di;a.Uq=this.Uq;a.ds=this.ds;a.Iq=this.Iq;a.Sq=this.Sq;a.mr=this.mr;a.gr=this.gr;a.xg=this.xg;a.Yq=this.Yq;a.bs=this.bs;a.$r=this.$r;a.pd=this.pd;return a};
ce.prototype.toString=function(){var a="^";0!==this.modifiers&&(a+="M:"+this.modifiers);0!==this.button&&(a+="B:"+this.button);""!==this.key&&(a+="K:"+this.key);0!==this.clickCount&&(a+="C:"+this.clickCount);0!==this.delta&&(a+="D:"+this.delta);this.handled&&(a+="h");this.bubbles&&(a+="b");null!==this.documentPoint&&(a+="@"+this.documentPoint.toString());return a};ce.prototype.Zp=function(a,b){var c=this.diagram;if(null===c)return b;de(c,this.event,a,b);return b};
ce.prototype.Zz=function(a,b){var c=this.diagram;if(null===c)return b;de(c,this.event,a,b);b.assign(c.Xs(b));return b};
na.Object.defineProperties(ce.prototype,{diagram:{get:function(){return this.C},set:function(a){this.C=a}},viewPoint:{get:function(){return this.ou},set:function(a){this.ou.assign(a)}},documentPoint:{get:function(){return this.yt},set:function(a){this.yt.assign(a)}},modifiers:{get:function(){return this.yr},set:function(a){this.yr=a}},button:{get:function(){return this.Fq},
set:function(a){this.Fq=a;if(null===this.event)switch(a){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2}}},buttons:{get:function(){return this.Gq},set:function(a){this.Gq=a}},key:{get:function(){return this.di},set:function(a){this.di=a}},down:{get:function(){return this.Uq},set:function(a){this.Uq=a}},up:{get:function(){return this.ds},set:function(a){this.ds=
a}},clickCount:{get:function(){return this.Iq},set:function(a){this.Iq=a}},delta:{get:function(){return this.Sq},set:function(a){this.Sq=a}},isMultiTouch:{get:function(){return this.mr},set:function(a){this.mr=a}},handled:{get:function(){return this.gr},set:function(a){this.gr=a}},bubbles:{get:function(){return this.xg},set:function(a){this.xg=a}},event:{
get:function(){return this.Yq},set:function(a){this.Yq=a}},isTouchEvent:{get:function(){var a=x.TouchEvent,b=this.event;return a&&b instanceof a?!0:(a=x.PointerEvent)&&b instanceof a&&("touch"===b.pointerType||"pen"===b.pointerType)}},timestamp:{get:function(){return this.bs},set:function(a){this.bs=a}},targetDiagram:{get:function(){return this.$r},set:function(a){this.$r=a}},targetObject:{
get:function(){return this.pd},set:function(a){this.pd=a}},control:{get:function(){return 0!==(this.modifiers&1)},set:function(a){this.modifiers=a?this.modifiers|1:this.modifiers&-2}},shift:{get:function(){return 0!==(this.modifiers&4)},set:function(a){this.modifiers=a?this.modifiers|4:this.modifiers&-5}},alt:{get:function(){return 0!==(this.modifiers&2)},set:function(a){this.modifiers=a?this.modifiers|
2:this.modifiers&-3}},meta:{get:function(){return 0!==(this.modifiers&8)},set:function(a){this.modifiers=a?this.modifiers|8:this.modifiers&-9}},left:{get:function(){var a=this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&1):0===this.button},set:function(a){this.buttons=a?this.buttons|1:this.buttons&-2}},right:{get:function(){var a=
this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&2):2===this.button},set:function(a){this.buttons=a?this.buttons|2:this.buttons&-3}},middle:{get:function(){var a=this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&4):1===this.button},set:function(a){this.buttons=a?this.buttons|4:this.buttons&-5}}});
ce.prototype.getMultiTouchDocumentPoint=ce.prototype.Zz;ce.prototype.getMultiTouchViewPoint=ce.prototype.Zp;ce.className="InputEvent";function ee(){this.C=null;this.na="";this.Gr=this.Wr=null}ee.prototype.copy=function(){var a=new ee;a.C=this.C;a.na=this.na;a.Wr=this.Wr;a.Gr=this.Gr;return a};ee.prototype.toString=function(){var a="*"+this.name;null!==this.subject&&(a+=":"+this.subject.toString());null!==this.parameter&&(a+="("+this.parameter.toString()+")");return a};
na.Object.defineProperties(ee.prototype,{diagram:{get:function(){return this.C},set:function(a){this.C=a}},name:{get:function(){return this.na},set:function(a){this.na=a}},subject:{get:function(){return this.Wr},set:function(a){this.Wr=a}},parameter:{get:function(){return this.Gr},set:function(a){this.Gr=a}}});ee.className="DiagramEvent";
function fe(){this.Vm=ge;this.ff=this.xr="";this.Ao=this.Bo=this.Go=this.Ho=this.Fo=this.C=this.Wb=null}fe.prototype.clear=function(){this.Ao=this.Bo=this.Go=this.Ho=this.Fo=this.C=this.Wb=null};
fe.prototype.copy=function(){var a=new fe;a.Vm=this.Vm;a.xr=this.xr;a.ff=this.ff;a.Wb=this.Wb;a.C=this.C;a.Fo=this.Fo;var b=this.Ho;a.Ho=za(b)&&"function"===typeof b.I?b.I():b;b=this.Go;a.Go=za(b)&&"function"===typeof b.I?b.I():b;b=this.Bo;a.Bo=za(b)&&"function"===typeof b.I?b.I():b;b=this.Ao;a.Ao=za(b)&&"function"===typeof b.I?b.I():b;return a};fe.prototype.gb=function(a){a.classType===fe&&(this.change=a)};
fe.prototype.toString=function(){var a="";a=this.change===he?a+"* ":this.change===ge?a+(null!==this.model?"!m":"!d"):a+((null!==this.model?"!m":"!d")+this.change);this.propertyName&&"string"===typeof this.propertyName&&(a+=" "+this.propertyName);this.modelChange&&this.modelChange!==this.propertyName&&(a+=" "+this.modelChange);a+=": ";this.change===he?null!==this.oldValue&&(a+=" "+this.oldValue):(null!==this.object&&(a+=La(this.object)),null!==this.oldValue&&(a+="  old: "+La(this.oldValue)),null!==
this.oldParam&&(a+=" "+this.oldParam),null!==this.newValue&&(a+="  new: "+La(this.newValue)),null!==this.newParam&&(a+=" "+this.newParam));return a};fe.prototype.H=function(a){return a?this.oldValue:this.newValue};fe.prototype.aA=function(a){return a?this.oldParam:this.newParam};fe.prototype.canUndo=function(){return null!==this.model||null!==this.diagram?!0:!1};
fe.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.changeState(this,!0):null!==this.diagram&&this.diagram.changeState(this,!0))};fe.prototype.canRedo=function(){return null!==this.model||null!==this.diagram?!0:!1};fe.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.changeState(this,!1):null!==this.diagram&&this.diagram.changeState(this,!1))};
na.Object.defineProperties(fe.prototype,{model:{get:function(){return this.Wb},set:function(a){this.Wb=a}},diagram:{get:function(){return this.C},set:function(a){this.C=a}},change:{get:function(){return this.Vm},set:function(a){this.Vm=a}},modelChange:{get:function(){return this.xr},set:function(a){this.xr=a}},propertyName:{get:function(){return this.ff},
set:function(a){this.ff=a}},isTransactionFinished:{get:function(){return this.Vm===he&&("CommittedTransaction"===this.ff||"FinishedUndo"===this.ff||"FinishedRedo"===this.ff)}},object:{get:function(){return this.Fo},set:function(a){this.Fo=a}},oldValue:{get:function(){return this.Ho},set:function(a){this.Ho=a}},oldParam:{get:function(){return this.Go},set:function(a){this.Go=a}},
newValue:{get:function(){return this.Bo},set:function(a){this.Bo=a}},newParam:{get:function(){return this.Ao},set:function(a){this.Ao=a}}});fe.prototype.redo=fe.prototype.redo;fe.prototype.canRedo=fe.prototype.canRedo;fe.prototype.undo=fe.prototype.undo;fe.prototype.canUndo=fe.prototype.canUndo;fe.prototype.getParam=fe.prototype.aA;fe.prototype.getValue=fe.prototype.H;fe.prototype.clear=fe.prototype.clear;
var he=new D(fe,"Transaction",-1),ge=new D(fe,"Property",0),ie=new D(fe,"Insert",1),pe=new D(fe,"Remove",2);fe.className="ChangedEvent";fe.Transaction=he;fe.Property=ge;fe.Insert=ie;fe.Remove=pe;function qe(){this.o=(new F).freeze();this.na="";this.j=!1}qe.prototype.toString=function(a){var b="Transaction: "+this.name+" "+this.changes.count.toString()+(this.isComplete?"":", incomplete");if(void 0!==a&&0<a){a=this.changes.count;for(var c=0;c<a;c++){var d=this.changes.J(c);null!==d&&(b+="\n  "+d.toString())}}return b};
qe.prototype.clear=function(){var a=this.changes;a.ea();for(var b=a.count-1;0<=b;b--){var c=a.J(b);null!==c&&c.clear()}a.clear();a.freeze()};qe.prototype.canUndo=function(){return this.isComplete};qe.prototype.undo=function(){if(this.canUndo())for(var a=this.changes.count-1;0<=a;a--){var b=this.changes.J(a);null!==b&&b.undo()}};qe.prototype.canRedo=function(){return this.isComplete};
qe.prototype.redo=function(){if(this.canRedo())for(var a=this.changes.count,b=0;b<a;b++){var c=this.changes.J(b);null!==c&&c.redo()}};
qe.prototype.Ms=function(){if(this.isComplete){var a=this.changes;a.ea();for(var b=new I,c=0;c<a.count;c++){var d=a.J(c);if(null!==d&&d.change===ge&&d.object){var e=b.get(d.object);e||(e=new I,b.set(d.object,e));var f=e.get(d.propertyName);null===f?e.set(d.propertyName,-1):(0<f&&a.Pc(f,null),e.set(d.propertyName,c))}}for(c=b=0;c<a.count;c++)d=a.J(c),null!==d&&(c>b&&a.Pc(b,d),b++);for(;a.length>b;)a.pop();a.freeze()}};
na.Object.defineProperties(qe.prototype,{changes:{get:function(){return this.o}},name:{get:function(){return this.na},set:function(a){this.na=a}},isComplete:{get:function(){return this.j},set:function(a){this.j=a}}});qe.prototype.optimize=qe.prototype.Ms;qe.prototype.redo=qe.prototype.redo;qe.prototype.canRedo=qe.prototype.canRedo;qe.prototype.undo=qe.prototype.undo;qe.prototype.canUndo=qe.prototype.canUndo;
qe.prototype.clear=qe.prototype.clear;qe.className="Transaction";function re(){this.Rt=new G;this.wd=!1;this.D=(new F).freeze();this.se=-1;this.o=999;this.ue=!1;this.Qq=null;this.xi=0;this.j=!1;this.ze=(new F).freeze();this.ql=new F;this.Ft=!0;this.It=this.kr=this.Lt=this.Kt=!1}
re.prototype.toString=function(a){var b="UndoManager "+this.historyIndex+"<"+this.history.count+"<="+this.maxHistoryLength;b+="[";for(var c=this.nestedTransactionNames.count,d=0;d<c;d++)0<d&&(b+=" "),b+=this.nestedTransactionNames.J(d);b+="]";if(void 0!==a&&0<a)for(c=this.history.count,d=0;d<c;d++)b+="\n "+this.history.J(d).toString(a-1);return b};
re.prototype.clear=function(){var a=this.history;a.ea();for(var b=a.count-1;0<=b;b--){var c=a.J(b);null!==c&&c.clear()}a.clear();this.se=-1;a.freeze();this.ue=!1;this.Qq=null;this.xi=0;this.ze.ea();this.ze.clear();this.ze.freeze();this.ql.clear();this.It=this.kr=this.Lt=this.Kt=!1};re.prototype.copyProperties=function(a){this.isEnabled=a.isEnabled;this.maxHistoryLength=a.maxHistoryLength;this.checksTransactionLevel=a.checksTransactionLevel};t=re.prototype;t.ux=function(a){this.Rt.add(a)};t.py=function(a){this.Rt.remove(a)};
t.xa=function(a){void 0===a&&(a="");null===a&&(a="");if(this.isUndoingRedoing)return!1;!0===this.Ft&&(this.Ft=!1,this.xi++,this.isInternalTransaction||this.Db("StartingFirstTransaction",a,this.currentTransaction),0<this.xi&&this.xi--);this.isEnabled&&(this.ze.ea(),this.ze.add(a),this.ze.freeze(),null===this.currentTransaction?this.ql.add(0):this.ql.add(this.currentTransaction.changes.count));this.xi++;var b=1===this.transactionLevel;b&&(this.isInternalTransaction||this.Db("StartedTransaction",a,this.currentTransaction));
return b};t.Xa=function(a){void 0===a&&(a="");return se(this,!0,a)};t.Hf=function(){return se(this,!1,"")};
function se(a,b,c){if(a.isUndoingRedoing)return!1;a.checksTransactionLevel&&1>a.transactionLevel&&ya("Ending transaction without having started a transaction: "+c);var d=1===a.transactionLevel,e=a.currentTransaction;d&&b&&(a.isInternalTransaction||a.Db("CommittingTransaction",c,e));var f=0;if(0<a.transactionLevel&&(a.xi--,a.isEnabled)){var g=a.ze.count;0<g&&(""===c&&(c=a.ze.J(0)),a.ze.ea(),a.ze.eb(g-1),a.ze.freeze());g=a.ql.count;0<g&&(f=a.ql.J(g-1),a.ql.eb(g-1))}if(d){if(b){a.kr=!1;null===e&&""!==
c&&(e=a.currentTransaction);if(a.isEnabled&&null!==e){e.isComplete||(e.isComplete=!0,e.name=c);b=a.history;b.ea();for(d=b.count-1;d>a.historyIndex;d--)f=b.J(d),null!==f&&f.clear(),b.eb(d),a.kr=!0;d=a.maxHistoryLength;0<=d&&(0===d?b.clear():b.count>=d&&(f=b.J(0),null!==f&&f.clear(),b.eb(0),a.se--));0===d||0!==b.count&&b.get(b.count-1)===e||(b.add(e),a.se++);b.freeze()}a.isInternalTransaction||a.Db("CommittedTransaction",c,e)}else{a.ue=!0;try{a.isEnabled&&null!==e&&(e.isComplete=!0,e.undo())}finally{a.isInternalTransaction||
a.Db("RolledBackTransaction",c,e),a.ue=!1}null!==e&&e.clear()}a.Qq=null;a.isPendingClear&&a.clear();a.isPendingClear=!1;a.isPendingUnmodified=!1;return!0}if(a.isEnabled&&!b&&null!==e){a=f;c=e.changes;for(e=c.count-1;e>=a;e--)b=c.J(e),null!==b&&b.undo(),c.ea(),c.eb(e);c.freeze()}return!1}re.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToUndo;return null!==a&&a.canUndo()?!0:!1};
re.prototype.undo=function(){if(this.canUndo()){var a=this.transactionToUndo;try{this.ue=!0,this.Db("StartingUndo","Undo",a),this.se--,a.undo()}catch(b){ya("undo error: "+b.toString())}finally{this.Db("FinishedUndo","Undo",a),this.ue=!1}}};re.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToRedo;return null!==a&&a.canRedo()?!0:!1};
re.prototype.redo=function(){if(this.canRedo()){var a=this.transactionToRedo;try{this.ue=!0,this.Db("StartingRedo","Redo",a),this.se++,a.redo()}catch(b){ya("redo error: "+b.toString())}finally{this.Db("FinishedRedo","Redo",a),this.ue=!1}}};re.prototype.Db=function(a,b,c){void 0===c&&(c=null);var d=new fe;d.change=he;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.models;a.next();)b=a.value,d.model=b,b.js(d)};
re.prototype.Yu=function(a){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(a)){var b=this.currentTransaction;null===b&&(this.Qq=b=new qe);var c=a.copy();b=b.changes;b.ea();b.add(c);b.freeze();this.checksTransactionLevel&&0>=this.transactionLevel&&!this.Ft&&(a=a.diagram,null!==a&&!1===a.Oi||ya("Change not within a transaction: "+c.toString()))}};
re.prototype.skipsEvent=function(a){if(null===a||0>a.change.value)return!0;a=a.object;if(null===a)return!1;if(void 0!==a.layer){if(a=a.layer,null!==a&&a.isTemporary)return!0}else if(a.isTemporary)return!0;return!1};
na.Object.defineProperties(re.prototype,{models:{get:function(){return this.Rt.iterator}},isEnabled:{get:function(){return this.wd},set:function(a){this.wd=a}},transactionToUndo:{get:function(){return 0<=this.historyIndex&&this.historyIndex<=this.history.count-1?this.history.J(this.historyIndex):null}},transactionToRedo:{get:function(){return this.historyIndex<this.history.count-
1?this.history.J(this.historyIndex+1):null}},isUndoingRedoing:{get:function(){return this.ue}},history:{get:function(){return this.D}},maxHistoryLength:{get:function(){return this.o},set:function(a){this.o=a}},historyIndex:{get:function(){return this.se}},currentTransaction:{get:function(){return this.Qq}},transactionLevel:{
get:function(){return this.xi}},isInTransaction:{get:function(){return 0<this.xi}},checksTransactionLevel:{get:function(){return this.j},set:function(a){this.j=a}},nestedTransactionNames:{get:function(){return this.ze}},isPendingClear:{get:function(){return this.Kt},set:function(a){this.Kt=a}},isPendingUnmodified:{get:function(){return this.Lt},set:function(a){this.Lt=
a}},isInternalTransaction:{get:function(){return this.It},set:function(a){this.It=a}},isJustDiscarded:{get:function(){return this.kr}}});re.prototype.handleChanged=re.prototype.Yu;re.prototype.redo=re.prototype.redo;re.prototype.undo=re.prototype.undo;re.prototype.canUndo=re.prototype.canUndo;re.prototype.rollbackTransaction=re.prototype.Hf;re.prototype.commitTransaction=re.prototype.Xa;re.prototype.startTransaction=re.prototype.xa;
re.prototype.removeModel=re.prototype.py;re.prototype.addModel=re.prototype.ux;re.prototype.clear=re.prototype.clear;re.className="UndoManager";function te(){Ua(this);this.C=ue;this.na="";this.wd=!0;this.Qb=!1;this.sk=null;this.Wy=new ce;this.fs=-1}te.prototype.toString=function(){return""!==this.name?this.name+" Tool":Ka(this.constructor)};te.prototype.updateAdornments=function(){};te.prototype.canStart=function(){return this.isEnabled};te.prototype.doStart=function(){};
te.prototype.doActivate=function(){this.isActive=!0};te.prototype.doDeactivate=function(){this.isActive=!1};te.prototype.doStop=function(){};te.prototype.doCancel=function(){this.transactionResult=null;this.stopTool()};te.prototype.stopTool=function(){var a=this.diagram;a.currentTool===this&&(a.currentTool=null,a.currentCursor="")};te.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()};te.prototype.doMouseMove=function(){};te.prototype.doMouseUp=function(){this.stopTool()};
te.prototype.doMouseWheel=function(){};te.prototype.canStartMultiTouch=function(){return!0};te.prototype.standardPinchZoomStart=function(){var a=this.diagram,b=a.lastInput,c=b.Zp(0,J.allocAt(NaN,NaN)),d=b.Zp(1,J.allocAt(NaN,NaN));if(c.u()&&d.u()&&(this.doCancel(),a.am("hasGestureZoom"))){a.Xw=a.scale;var e=d.x-c.x,f=d.y-c.y;a.gx=Math.sqrt(e*e+f*f);b.bubbles=!1}J.free(c);J.free(d)};
te.prototype.standardPinchZoomMove=function(){var a=this.diagram,b=a.lastInput,c=b.Zp(0,J.allocAt(NaN,NaN)),d=b.Zp(1,J.allocAt(NaN,NaN));if(c.u()&&d.u()&&(this.doCancel(),a.am("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y;f=Math.sqrt(e*e+f*f)/a.gx;e=new J((Math.min(d.x,c.x)+Math.max(d.x,c.x))/2,(Math.min(d.y,c.y)+Math.max(d.y,c.y))/2);f*=a.Xw;var g=a.commandHandler;if(f!==a.scale&&g.canResetZoom(f)){var h=a.zoomPoint;a.zoomPoint=e;g.resetZoom(f);a.zoomPoint=h}b.bubbles=!1}J.free(c);J.free(d)};
te.prototype.doKeyDown=function(){"Esc"===this.diagram.lastInput.key&&this.doCancel()};te.prototype.doKeyUp=function(){};te.prototype.xa=function(a){void 0===a&&(a=this.name);this.transactionResult=null;return this.diagram.xa(a)};te.prototype.stopTransaction=function(){var a=this.diagram;return null===this.transactionResult?a.Hf():a.Xa(this.transactionResult)};
te.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lastInput,c=a.Zl(b.documentPoint,!1);if(null!==c)if(Ta?b.meta:b.control){a.S("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!b.isSelected);a.S("ChangedSelection",a.selection)}else if(b.shift){if(!c.isSelected){a.S("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!0);a.S("ChangedSelection",
a.selection)}}else{if(!c.isSelected){for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&a.select(b)}}else!b.left||(Ta?b.meta:b.control)||b.shift||a.clearSelection()}};te.prototype.standardMouseClick=function(a,b){void 0===a&&(a=null);void 0===b&&(b=function(a){return!a.layer.isTemporary});var c=this.diagram,d=c.lastInput;a=c.Zb(d.documentPoint,a,b);d.targetObject=a;ve(a,d,c);return d.handled};
function ve(a,b,c){b.handled=!1;if(null===a||a.Ef()){var d=0;b.left?d=1===b.clickCount?1:2===b.clickCount?2:1:b.right&&1===b.clickCount&&(d=3);var e="ObjectSingleClicked";if(null!==a){switch(d){case 1:e="ObjectSingleClicked";break;case 2:e="ObjectDoubleClicked";break;case 3:e="ObjectContextClicked"}0!==d&&c.S(e,a)}else{switch(d){case 1:e="BackgroundSingleClicked";break;case 2:e="BackgroundDoubleClicked";break;case 3:e="BackgroundContextClicked"}0!==d&&c.S(e)}if(null!==a)for(;null!==a;){c=null;switch(d){case 1:c=
a.click;break;case 2:c=a.doubleClick?a.doubleClick:a.click;break;case 3:c=a.contextClick}if(null!==c&&(c(b,a),b.handled))break;a=a.panel}else{a=null;switch(d){case 1:a=c.click;break;case 2:a=c.doubleClick?c.doubleClick:c.click;break;case 3:a=c.contextClick}null!==a&&a(b)}}}
te.prototype.standardMouseOver=function(){var a=this.diagram,b=a.lastInput;if(!0!==a.animationManager.tb){var c=a.skipsUndoManager;a.skipsUndoManager=!0;var d=a.viewportBounds.$(b.documentPoint)?a.Zb(b.documentPoint,null,null):null;b.targetObject=d;var e=!1;if(d!==a.Jk){var f=a.Jk,g=f;a.Jk=d;this.doCurrentObjectChanged(f,d);for(b.handled=!1;null!==f;){var h=f.mouseLeave;if(null!==h){if(d===f)break;if(null!==d&&d.rg(f))break;h(b,f,d);e=!0;if(b.handled)break}f=f.panel}f=g;for(b.handled=!1;null!==d;){g=
d.mouseEnter;if(null!==g){if(f===d)break;if(null!==f&&f.rg(d))break;g(b,d,f);e=!0;if(b.handled)break}d=d.panel}d=a.Jk}if(null!==d){f=d;for(g="";null!==f;){g=f.cursor;if(""!==g)break;f=f.panel}a.currentCursor=g;b.handled=!1;for(f=d;null!==f;){d=f.mouseOver;if(null!==d&&(d(b,f),e=!0,b.handled))break;f=f.panel}}else a.currentCursor="",d=a.mouseOver,null!==d&&(d(b),e=!0);e&&a.Fb();a.skipsUndoManager=c}};te.prototype.doCurrentObjectChanged=function(){};
te.prototype.standardMouseWheel=function(){var a=this.diagram,b=a.lastInput,c=b.delta;if(0!==c&&a.documentBounds.u()){var d=a.commandHandler,e=a.toolManager.mouseWheelBehavior;if(null!==d&&(e===we&&!b.shift||e===xe&&b.control)){if(0<c?d.canIncreaseZoom():d.canDecreaseZoom())e=a.zoomPoint,a.zoomPoint=b.viewPoint,0<c?d.increaseZoom():d.decreaseZoom(),a.zoomPoint=e;b.bubbles=!1}else if(e===we&&b.shift||e===xe&&!b.control){d=a.position.copy();var f=0<c?c:-c,g=b.event,h=g.deltaMode;e=g.deltaX;g=g.deltaY;
if(Ra||Sa)h=1,0<e&&(e=3),0>e&&(e=-3),0<g&&(g=3),0>g&&(g=-3);if(void 0===h||void 0===e||void 0===g||0===e&&0===g||b.shift)!b.shift&&a.allowVerticalScroll?(f=3*f*a.scrollVerticalLineChange,0<c?a.scroll("pixel","up",f):a.scroll("pixel","down",f)):b.shift&&a.allowHorizontalScroll&&(f=3*f*a.scrollHorizontalLineChange,0<c?a.scroll("pixel","left",f):a.scroll("pixel","right",f));else{switch(h){case 0:c="pixel";break;case 1:c="line";break;case 2:c="page";break;default:c="pixel"}0!==e&&a.allowHorizontalScroll&&
(e*=a.scrollHorizontalLineChange/16,0<e?a.scroll(c,"left",-e):a.scroll(c,"right",e));0!==g&&a.allowVerticalScroll&&(g*=a.scrollVerticalLineChange/16,0<g?a.scroll(c,"up",-g):a.scroll(c,"down",g))}a.position.A(d)||(b.bubbles=!1)}}};te.prototype.standardWaitAfter=function(a,b){void 0===b&&(b=this.diagram.lastInput);this.cancelWaitAfter();var c=this,d=b.clone(this.Wy);this.fs=ua(function(){c.doWaitAfter(d)},a)};te.prototype.cancelWaitAfter=function(){-1!==this.fs&&x.clearTimeout(this.fs);this.fs=-1};
te.prototype.doWaitAfter=function(){};te.prototype.findToolHandleAt=function(a,b){a=this.diagram.Zb(a,function(a){for(;null!==a&&!(a.panel instanceof ye);)a=a.panel;return a});return null===a?null:a.part.category===b?a:null};te.prototype.isBeyondDragSize=function(a,b){var c=this.diagram;void 0===a&&(a=c.firstInput.viewPoint);void 0===b&&(b=c.lastInput.viewPoint);var d=c.toolManager.dragSize,e=d.width;d=d.height;c.firstInput.isTouchEvent&&(e+=6,d+=6);return Math.abs(b.x-a.x)>e||Math.abs(b.y-a.y)>d};
na.Object.defineProperties(te.prototype,{diagram:{get:function(){return this.C},set:function(a){a instanceof R&&(this.C=a)}},name:{get:function(){return this.na},set:function(a){this.na=a}},isEnabled:{get:function(){return this.wd},set:function(a){this.wd=a}},isActive:{get:function(){return this.Qb},set:function(a){this.Qb=a}},transactionResult:{get:function(){return this.sk},
set:function(a){this.sk=a}}});te.prototype.startTransaction=te.prototype.xa;te.className="Tool";function Pa(){te.call(this);this.name="ToolManager";this.Gb=new F;this.Rb=new F;this.rc=new F;this.L=this.wa=850;this.o=(new Fb(2,2)).ca();this.Ma=5E3;this.Ba=xe;this.D=ze;this.Pq=this.j=null;this.Jj=-1}ma(Pa,te);Pa.prototype.initializeStandardTools=function(){};
Pa.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof ye&&this.Pq===a){var c=b.adornedObject;(null!==a?c.part===a:null===c)?this.showToolTip(b,c):this.hideToolTip()}};
Pa.prototype.doMouseDown=function(){var a=this.diagram,b=a.lastInput;b.isTouchEvent&&this.gestureBehavior===Ae&&(b.bubbles=!1);if(b.isMultiTouch){this.cancelWaitAfter();if(this.gestureBehavior===Be){b.bubbles=!0;return}if(this.gestureBehavior===Ae)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomStart();return}}for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.J(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===
e&&(e.isActive||e.doActivate(),e.doMouseDown());return}}1===a.lastInput.button&&(this.mouseWheelBehavior===xe?this.mouseWheelBehavior=we:this.mouseWheelBehavior===we&&(this.mouseWheelBehavior=xe));this.doActivate();this.standardWaitAfter(this.holdDelay,b)};
Pa.prototype.doMouseMove=function(){var a=this.diagram,b=a.lastInput;if(b.isMultiTouch){if(this.gestureBehavior===Be){b.bubbles=!0;return}if(this.gestureBehavior===Ae)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomMove();return}}if(this.isActive)for(var c=this.mouseMoveTools.length,d=0;d<c;d++){var e=this.mouseMoveTools.J(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===e&&(e.isActive||e.doActivate(),e.doMouseMove());return}}Ce(this,
a);a=b.event;null===a||"pointermove"!==a.type&&a.cancelable||(b.bubbles=!0)};function Ce(a,b){a.standardMouseOver();a.isBeyondDragSize()&&a.standardWaitAfter(a.isActive?a.holdDelay:a.hoverDelay,b.lastInput)}Pa.prototype.doCurrentObjectChanged=function(a,b){a=this.currentToolTip;null===a||null!==b&&a instanceof ye&&(b===a||b.rg(a))||this.hideToolTip()};
Pa.prototype.doWaitAfter=function(a){var b=this.diagram;b.Ca&&(this.doMouseHover(),this.isActive||this.doToolTip(),a.isTouchEvent&&!b.lastInput.handled&&(a=a.copy(),a.button=2,a.buttons=2,b.lastInput=a,b.ju=!0,b.doMouseUp()))};
Pa.prototype.doMouseHover=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Zb(b.documentPoint,null,null));var c=b.targetObject;if(null!==c)for(b.handled=!1;null!==c;){a=this.isActive?c.mouseHold:c.mouseHover;if(null!==a&&(a(b,c),b.handled))break;c=c.panel}else c=this.isActive?a.mouseHold:a.mouseHover,null!==c&&c(b)};
Pa.prototype.doToolTip=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Zb(b.documentPoint,null,null));b=b.targetObject;if(null!==b){if(a=this.currentToolTip,!(a instanceof ye)||b!==a&&!b.rg(a)){for(;null!==b;){a=b.toolTip;if(null!==a){this.showToolTip(a,b);return}b=b.panel}this.hideToolTip()}}else b=a.toolTip,null!==b?this.showToolTip(b,null):this.hideToolTip()};
Pa.prototype.showToolTip=function(a,b){var c=this.diagram;a!==this.currentToolTip&&this.hideToolTip();if(a instanceof ye){a.layerName="Tool";a.selectable=!1;a.scale=1/c.scale;a.category="ToolTip";null!==a.placeholder&&(a.placeholder.scale=c.scale);var d=a.diagram;null!==d&&d!==c&&d.remove(a);c.add(a);null!==b?a.adornedObject=b:a.data=c.model;a.Ta();this.positionToolTip(a,b)}else a instanceof De&&a!==this.currentToolTip&&a.show(b,c,this);this.currentToolTip=a;-1!==this.Jj&&(x.clearTimeout(this.Jj),
this.Jj=-1);a=this.toolTipDuration;if(0<a&&Infinity!==a){var e=this;this.Jj=ua(function(){e.hideToolTip()},a)}};Pa.prototype.positionToolTip=function(a){if(null===a.placeholder){var b=this.diagram,c=b.lastInput.documentPoint.copy(),d=a.measuredBounds,e=b.viewportBounds;b.lastInput.isTouchEvent&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5/b.scale);c.x<e.x&&(c.x=e.x);c.y=c.y+20/b.scale+d.height>e.bottom?c.y-(d.height+5/b.scale):c.y+20/b.scale;c.y<e.y&&(c.y=e.y);a.position=c}};
Pa.prototype.hideToolTip=function(){-1!==this.Jj&&(x.clearTimeout(this.Jj),this.Jj=-1);var a=this.diagram,b=this.currentToolTip;null!==b&&(b instanceof ye?(a.remove(b),null!==this.Pq&&this.Pq.Gf(b.category),b.data=null,b.adornedObject=null):b instanceof De&&null!==b.hide&&b.hide(a,this),this.currentToolTip=null)};
Pa.prototype.doMouseUp=function(){this.cancelWaitAfter();var a=this.diagram;if(this.isActive)for(var b=this.mouseUpTools.length,c=0;c<b;c++){var d=this.mouseUpTools.J(c);d.diagram=this.diagram;if(d.canStart()){a.doFocus();a.currentTool=d;a.currentTool===d&&(d.isActive||d.doActivate(),d.doMouseUp());return}}a.doFocus();this.doDeactivate()};Pa.prototype.doMouseWheel=function(){this.standardMouseWheel()};Pa.prototype.doKeyDown=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyDown()};
Pa.prototype.doKeyUp=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyUp()};Pa.prototype.findTool=function(a){for(var b=this.mouseDownTools.length,c=0;c<b;c++){var d=this.mouseDownTools.J(c);if(d.name===a)return d}b=this.mouseMoveTools.length;for(c=0;c<b;c++)if(d=this.mouseMoveTools.J(c),d.name===a)return d;b=this.mouseUpTools.length;for(c=0;c<b;c++)if(d=this.mouseUpTools.J(c),d.name===a)return d;return null};
Pa.prototype.replaceTool=function(a,b){null!==b&&(b.diagram=this.diagram);for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.J(d);if(e.name===a)return null!==b?this.mouseDownTools.Pc(d,b):this.mouseDownTools.eb(d),e}c=this.mouseMoveTools.length;for(d=0;d<c;d++)if(e=this.mouseMoveTools.J(d),e.name===a)return null!==b?this.mouseMoveTools.Pc(d,b):this.mouseMoveTools.eb(d),e;c=this.mouseUpTools.length;for(d=0;d<c;d++)if(e=this.mouseUpTools.J(d),e.name===a)return null!==b?this.mouseUpTools.Pc(d,
b):this.mouseUpTools.eb(d),e;return null};Pa.prototype.Za=function(a,b,c){null!==b&&(b.name=a,b.diagram=this.diagram);this.findTool(a)?this.replaceTool(a,b):null!==b&&c.add(b)};
na.Object.defineProperties(Pa.prototype,{mouseWheelBehavior:{get:function(){return this.Ba},set:function(a){this.Ba=a}},gestureBehavior:{get:function(){return this.D},set:function(a){this.D=a}},currentToolTip:{get:function(){return this.j},set:function(a){this.j=a;this.Pq=null!==a&&a instanceof ye?a.adornedPart:null}},mouseDownTools:{get:function(){return this.Gb}},mouseMoveTools:{
get:function(){return this.Rb}},mouseUpTools:{get:function(){return this.rc}},hoverDelay:{get:function(){return this.wa},set:function(a){this.wa=a}},holdDelay:{get:function(){return this.L},set:function(a){this.L=a}},dragSize:{get:function(){return this.o},set:function(a){this.o=a.I()}},toolTipDuration:{get:function(){return this.Ma},set:function(a){this.Ma=
a}}});Pa.prototype.replaceStandardTool=Pa.prototype.Za;var xe=new D(Pa,"WheelScroll",0),we=new D(Pa,"WheelZoom",1),Ee=new D(Pa,"WheelNone",2),ze=new D(Pa,"GestureZoom",3),Ae=new D(Pa,"GestureCancel",4),Be=new D(Pa,"GestureNone",5);Pa.className="ToolManager";Pa.WheelScroll=xe;Pa.WheelZoom=we;Pa.WheelNone=Ee;Pa.GestureZoom=ze;Pa.GestureCancel=Ae;Pa.GestureNone=Be;
function Fe(){te.call(this);this.name="Dragging";this.D=this.Rb=!0;this.o=this.Ma=this.wa=this.cg=null;this.rn=this.rc=!1;this.Il=new J(NaN,NaN);this.Ur=new J;this.Gb=!0;this.Pk=100;this.Jg=[];this.ke=(new G).freeze();this.Ba=new Le;this.co=null;this.L="copy";this.Nd="";this.Od="no-drop"}ma(Fe,te);
Fe.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly&&!a.allowDragOut||!a.allowMove&&!a.allowCopy&&!a.allowDragOut||!a.allowSelect)return!1;var b=a.lastInput;return!b.left||a.currentTool!==this&&(!this.isBeyondDragSize()||b.isTouchEvent&&b.timestamp-a.firstInput.timestamp<this.Pk)?!1:null!==this.findDraggablePart()};
Fe.prototype.findDraggablePart=function(){var a=this.diagram;a=a.Zl(a.firstInput.documentPoint,!1);if(null===a)return null;for(;null!==a&&!a.canSelect();)a=a.containingGroup;return null!==a&&(a.canMove()||a.canCopy())?a:null};
Fe.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.Zl(a.firstInput.documentPoint,!1);if(null!==b){for(;null!==b&&!b.canSelect();)b=b.containingGroup;this.currentPart=b;null===this.currentPart||this.currentPart.isSelected||(a.S("ChangingSelection",a.selection),b=a.lastInput,(Ta?b.meta:b.control)||b.shift||a.clearSelection(!0),this.currentPart.isSelected=!0,a.S("ChangedSelection",a.selection))}}};
Fe.prototype.doActivate=function(){var a=this.diagram;this.co=null;null===this.currentPart&&this.standardMouseSelect();var b=this.currentPart;null!==b&&(b.canMove()||b.canCopy())&&(a.zu(!0),Me=null,this.isActive=!0,this.Il.set(a.position),Ne(this,a.selection),this.Jg.length=0,a.animationManager.qc(),this.draggedParts=this.computeEffectiveCollection(a.selection,this.dragOptions),a.Vs=!0,!0===a.Ie("temporaryPixelRatio")&&30<a.xx&&Oe(a),Pe(a,this.draggedParts),this.xa("Drag"),this.startPoint=a.firstInput.documentPoint,
a.isMouseCaptured=!0,a.allowDragOut&&(this.isDragOutStarted=!0,this.rn=!1,Me=this,Qe=this.diagram,this.doSimulatedDragOut()))};function Ne(a,b){if(a.dragsLink){var c=a.diagram;c.allowRelink&&(c.model.bk()&&1===b.count&&b.first()instanceof T?(a.draggedLink=b.first(),a.draggedLink.canRelinkFrom()&&a.draggedLink.canRelinkTo()&&a.draggedLink.Oj(),a.cg=c.toolManager.findTool("Relinking"),null===a.cg&&(a.cg=new Re,a.cg.diagram=c)):(a.draggedLink=null,a.cg=null))}}
Fe.prototype.computeEffectiveCollection=function(a,b){return this.diagram.commandHandler.computeEffectiveCollection(a,b)};Fe.prototype.Bd=function(a){return void 0===a?new Se(qb):this.isGridSnapEnabled?new Se(new J(Math.round(1E3*a.x)/1E3,Math.round(1E3*a.y)/1E3)):new Se(a.copy())};
Fe.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.zu(!1);a.tg();Te(this);Ue(a,this.draggedParts);this.draggedParts=this.currentPart=this.co=null;this.rn=this.isDragOutStarted=!1;if(0<Ve.count){for(var b=Ve,c=b.length,d=0;d<c;d++){var e=b.J(d);We(e);Xe(e);Te(e);e.diagram.tg()}b.clear()}We(this);this.Il.h(NaN,NaN);null!==Qe&&(Qe.currentCursor="");Me=Qe=null;Xe(this);a.isMouseCaptured=!1;a.currentCursor="";a.Vs=!1;this.stopTransaction();Ye(a,!0)};
Fe.prototype.stopTransaction=function(){var a=this.diagram,b=te.prototype.stopTransaction.call(this);b&&null!==a.undoManager.transactionToUndo&&a.undoManager.transactionToUndo.Ms();return b};function Te(a){var b=a.diagram,c=b.skipsUndoManager;b.skipsUndoManager=!0;cf(a,b.lastInput,null);b.skipsUndoManager=c;a.Jg.length=0}function df(){var a=Me;Xe(a);ef(a);var b=a.diagram;a.Il.u()&&(b.position=a.Il);b.tg()}
Fe.prototype.doCancel=function(){Xe(this);ef(this);var a=this.diagram;this.Il.u()&&(a.position=this.Il);this.stopTool()};Fe.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput;this.isActive&&("Esc"===b.key?this.doCancel():b.key!==a.previousInput.key&&this.doMouseMove())};Fe.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()};
function ff(a,b){if(null===a.copiedParts){var c=a.diagram;if((!b||!c.isReadOnly&&!c.isModelReadOnly)&&null!==a.draggedParts){var d=c.undoManager;d.isEnabled&&d.isInTransaction?null!==d.currentTransaction&&0<d.currentTransaction.changes.count&&(c.undoManager.Hf(),c.xa("Drag")):ef(a);c.skipsUndoManager=!b;c.partManager.addsToTemporaryLayer=!b;a.startPoint=c.firstInput.documentPoint;b=a.copiesEffectiveCollection?a.draggedParts.If():c.selection;b=c.Tj(b,c,!0);c=new I;for(d=a.draggedParts.iterator;d.next();){var e=
d.key;if(e.Nc()&&e.canCopy()){var f=b.H(e);null!==f&&(f.location=e.location,f.Ta(),c.add(f,a.Bd(f.location)))}}for(b=b.iterator;b.next();)d=b.value,d instanceof T&&d.canCopy()&&c.add(d,a.Bd());a.copiedParts=c;Ne(a,c.If());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,gf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/2)));a.doUpdateCursor(null,!0)}}}
function Xe(a){var b=a.diagram;if(null!==a.copiedParts){b.Ps(a.copiedParts.If(),!1);a.copiedParts=null;if(null!==a.draggedParts)for(var c=a.draggedParts.iterator;c.next();)c.key instanceof T&&(c.value.point=new J(0,0));a.doUpdateCursor(null,!0)}b.skipsUndoManager=!1;b.partManager.addsToTemporaryLayer=!1;a.startPoint=b.firstInput.documentPoint}
function We(a){if(null!==a.draggedLink){if(a.dragsLink&&null!==a.cg){var b=a.cg;b.diagram.remove(b.temporaryFromNode);b.diagram.remove(b.temporaryToNode)}a.draggedLink=null;a.cg=null}}function hf(a,b,c){var d=a.diagram,e=a.startPoint,f=J.alloc();f.assign(d.lastInput.documentPoint);a.moveParts(b,f.ie(e),c);J.free(f);!0===d.Ie("temporaryPixelRatio")&&null===d.si&&30<d.xx&&(Oe(d),d.nq())}
Fe.prototype.moveParts=function(a,b,c){void 0===c&&(c=!1);var d=this.diagram;null!==d&&jf(d,a,b,this.dragOptions,c)};function ef(a){if(null!==a.draggedParts){for(var b=a.diagram,c=a.draggedParts.iterator;c.next();){var d=c.key;d.Nc()&&(d.location=c.value.point)}for(c=a.draggedParts.iterator;c.next();)if(d=c.key,d instanceof T&&d.suspendsRouting){var e=c.value.point;a.draggedParts.add(d,a.Bd());gf(d,-e.x,-e.y)}b.hd()}}
function kf(a,b){var c=a.diagram;a.dragsLink&&(null!==a.draggedLink&&(a.draggedLink.fromNode=null,a.draggedLink.toNode=null),lf(a,!1));var d=a.findDragOverObject(b),e=c.lastInput;e.targetObject=d;a.doUpdateCursor(d,!1);var f=c.skipsUndoManager,g=!1;try{c.skipsUndoManager=!0;g=cf(a,e,d);if(!a.isActive&&null===Me)return;var h=null!==d?d.part:null;if(null===h||c.handlesDragDropForTopLevelParts&&h.isTopLevel&&!(h instanceof U)){var k=c.mouseDragOver;null!==k&&(k(e),g=!0)}if(!a.isActive&&null===Me)return;
a.doDragOver(b,d);if(!a.isActive&&null===Me)return}finally{c.skipsUndoManager=f,g&&c.hd()}a.co=d;c.isReadOnly||!c.allowMove&&!c.allowCopy||!c.allowHorizontalScroll&&!c.allowVerticalScroll||c.ms(e.viewPoint)}Fe.prototype.findDragOverObject=function(a){var b=this;return mf(this.diagram,a,null,function(a){null===a?a=!0:(a=a.part,a=null===a||a instanceof ye||a.layer.isTemporary||b.draggedParts&&b.draggedParts.contains(a)||b.copiedParts&&b.copiedParts.contains(a)?!0:!1);return!a})};
Fe.prototype.doUpdateCursor=function(a,b){var c=this.diagram;if(b||this.co!==a)!this.diagram.currentTool.isActive||this.mayCopy()?c.currentCursor=this.copyCursor:this.mayMove()?c.currentCursor=this.moveCursor:this.mayDragOut()&&(c.currentCursor=this.nodropCursor)};
function cf(a,b,c){var d=!1,e=a.Jg.length,f=0<e?a.Jg[0]:null;if(c===f)return!1;b.handled=!1;for(var g=0;g<e;g++){var h=a.Jg[g],k=h.mouseDragLeave;if(null!==k&&(k(b,h,c),d=!0,b.handled))break}a.Jg.length=0;if(!a.isActive&&null===Me||null===c)return d;b.handled=!1;for(e=c;null!==e;)a.Jg.push(e),e=nf(e);e=a.Jg.length;for(c=0;c<e&&(g=a.Jg[c],h=g.mouseDragEnter,null===h||(h(b,g,f),d=!0,!b.handled));c++);return d}
function nf(a){var b=a.panel;return null!==b?b:a instanceof V&&!(a instanceof U)&&(a=a.containingGroup,null!==a&&a.handlesDragDropForMembers)?a:null}function of(a,b,c){var d=a.cg;if(null===d)return null;var e=a.diagram.pg(b,d.portGravity,function(a){return d.findValidLinkablePort(a,c)});a=J.alloc();var f=Infinity,g=null;for(e=e.iterator;e.next();){var h=e.value;if(null!==h.part){var k=h.da(xc,a);k=b.xf(k);k<f&&(g=h,f=k)}}J.free(a);return g}
function lf(a,b){var c=a.draggedLink;if(null!==c&&!(2>c.pointsCount)){var d=a.diagram;if(!d.isReadOnly){var e=a.cg;if(null!==e){var f=null,g=null;null===c.fromNode&&(f=of(a,c.i(0),!1),null!==f&&(g=f.part));var h=null,k=null;null===c.toNode&&(h=of(a,c.i(c.pointsCount-1),!0),null!==h&&(k=h.part));e.isValidLink(g,f,k,h)?b?(c.defaultFromPoint=c.i(0),c.defaultToPoint=c.i(c.pointsCount-1),c.suspendsRouting=!1,c.fromNode=g,null!==f&&(c.fromPortId=f.portId),c.toNode=k,null!==h&&(c.toPortId=h.portId),c.fromPort!==
d.ky&&d.S("LinkRelinked",c,d.ky),c.toPort!==d.ly&&d.S("LinkRelinked",c,d.ly)):pf(e,g,f,k,h):pf(e,null,null,null,null)}}}}Fe.prototype.doDragOver=function(){};
function qf(a,b){var c=a.diagram;a.dragsLink&&lf(a,!0);Te(a);var d=a.findDragOverObject(b),e=c.lastInput;e.targetObject=d;if(null!==d){e.handled=!1;for(var f=d;null!==f;){var g=f.mouseDrop;if(null!==g&&(g(e,f),e.handled))break;rf(a,e,f);f=nf(f)}}else f=c.mouseDrop,null!==f&&f(e);if(a.isActive||null!==Me){for(e=(a.copiedParts||a.draggedParts).iterator;e.next();)f=e.key,f instanceof W&&f.linksConnected.each(function(a){a.suspendsRouting=!1});a.doDropOnto(b,d);if(a.isActive||null!==Me){a=M.alloc();for(b=
c.selection.iterator;b.next();)d=b.value,d instanceof W&&sf(c,d,a);M.free(a)}}}function rf(a,b,c){a=a.diagram;c=c.part;!a.handlesDragDropForTopLevelParts||!c.isTopLevel||c instanceof U||(c=a.mouseDrop,null!==c&&c(b))}function sf(a,b,c){var d=!1;b.getAvoidableRect(c);a.viewportBounds.Ge(c)&&(d=!0);a=a.Qu(c,function(a){return a.part},function(a){return a instanceof T},!0,function(a){return a instanceof T},d);if(0!==a.count)for(a=a.iterator;a.next();)c=a.value,!c.Jd(b)&&c.isAvoiding&&c.Va()}
Fe.prototype.doDropOnto=function(){};Fe.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;this.simulatedMouseMove(b.event,b.documentPoint,b.targetDiagram)||null===this.currentPart||null===this.draggedParts||(this.mayCopy()?(ff(this,!1),Pe(a,this.copiedParts),hf(this,this.copiedParts,!1),Ue(a,this.copiedParts)):this.mayMove()?(Xe(this),hf(this,this.draggedParts,!0)):this.mayDragOut()?(ff(this,!1),hf(this,this.copiedParts,!1)):Xe(this),kf(this,a.lastInput.documentPoint))}};
Fe.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;if(!this.simulatedMouseUp(b.event,b.documentPoint,b.targetDiagram)){b=!1;var c=this.mayCopy();c&&null!==this.copiedParts?(Xe(this),ff(this,!0),Pe(a,this.copiedParts),hf(this,this.copiedParts,!1),Ue(a,this.copiedParts),null!==this.copiedParts&&(a.S("ChangingSelection",a.selection),a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}))):(b=!0,Xe(this),this.mayMove()&&(hf(this,this.draggedParts,
!0),kf(this,a.lastInput.documentPoint)));this.rn=!0;qf(this,a.lastInput.documentPoint);if(this.isActive){var d=c?this.copiedParts.If():this.draggedParts.If();this.copiedParts=null;b&&tf(this);a.Qa();Ue(a,this.draggedParts);this.transactionResult=c?"Copy":"Move";a.S(c?"SelectionCopied":"SelectionMoved",d)}this.stopTool();c&&a.S("ChangedSelection",a.selection)}}};
Fe.prototype.simulatedMouseMove=function(a,b,c){if(null===Me)return!1;var d=Me.diagram;c instanceof R||(c=null);var e=Qe;c!==e&&(null!==e&&e!==d&&(e.tg(),Me.isDragOutStarted=!1,e=e.toolManager.findTool("Dragging"),null!==e&&e.doSimulatedDragLeave()),Qe=c,null!==c&&c!==d&&(df(),e=c.toolManager.findTool("Dragging"),null!==e&&(Ve.contains(e)||Ve.add(e),e.doSimulatedDragEnter())),this.doUpdateCursor(null,!0));if(null===c||c===d||!c.allowDrop||c.isReadOnly||!c.allowInsert)return!1;d=c.toolManager.findTool("Dragging");
null!==d&&(null!==a&&(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&(a=a.changedTouches[0])),b=c.getMouse(a)),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.vq(b),c.lastInput.down=!1,c.lastInput.up=!1,d.doSimulatedDragOver());return!0};
Fe.prototype.simulatedMouseUp=function(a,b,c){if(null===Me)return!1;var d=Qe,e=Me.diagram;if(null===c)return Me.doCancel(),!0;if(c!==d){var f=d.toolManager.findTool("Dragging");if(null!==d&&d!==e&&null!==f)return d.tg(),Me.isDragOutStarted=!1,f.doSimulatedDragLeave(),!1;Qe=c;d=c.toolManager.findTool("Dragging");null!==d&&(df(),Ve.contains(d)||Ve.add(d),d.doSimulatedDragEnter())}return c!==this.diagram?(null!==a?(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&
(a=a.changedTouches[0])),b=c.getMouse(a)):null===b&&(b=new J),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.vq(b),c.lastInput.down=!1,c.lastInput.up=!0,a=c.toolManager.findTool("Dragging"),null!==a&&a.doSimulatedDrop(),a=Me,null!==a&&(c=a.mayCopy(),a.transactionResult=c?"Copy":"Move",a.stopTool()),!0):!1};
function tf(a){if(null!==a.draggedParts)for(var b=a.draggedParts.iterator;b.next();){var c=b.key;c instanceof W&&(c=c.containingGroup,null===c||null===c.placeholder||a.draggedParts.contains(c)||c.placeholder.s())}}
Fe.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowCopy||(Ta?!a.lastInput.alt:!a.lastInput.control))return!1;for(a=a.selection.iterator;a.next();)if(a.value.canCopy())return!0;return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
Fe.prototype.mayDragOut=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(!a.allowDragOut||!a.allowCopy||a.allowMove)return!1;for(a=a.selection.iterator;a.next();)if(a.value.canCopy())return!0;return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
Fe.prototype.mayMove=function(){var a=this.diagram;if(a.isReadOnly||!a.allowMove)return!1;for(a=a.selection.iterator;a.next();)if(a.value.canMove())return!0;return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canMove()?!0:!1};Fe.prototype.computeBorder=function(a,b,c){return this.rn||null===this.draggedParts||this.draggedParts.contains(a)?null:c.assign(b)};Fe.prototype.Yz=function(){return Me};
Fe.prototype.mayDragIn=function(){var a=this.diagram;if(!a.allowDrop||a.isReadOnly||a.isModelReadOnly||!a.allowInsert)return!1;var b=Me;return null===b||b.diagram.model.dataFormat!==a.model.dataFormat?!1:!0};Fe.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.diagram;a.animationManager.qc();uf(a);a.animationManager.qc();a=Me;null!==a&&(a.diagram.Vs=!1);this.doUpdateCursor(null,!0)}};Fe.prototype.doSimulatedDragLeave=function(){var a=Me;null!==a&&a.doSimulatedDragOut();this.doCancel()};
Fe.prototype.doSimulatedDragOver=function(){var a=this.diagram;a.animationManager.Tm=!0;var b=Me;if(null!==b&&null!==b.draggedParts){if(!this.mayDragIn())return;vf(this,b.draggedParts.If(),!1,a.firstInput);hf(this,this.copiedParts,!1);kf(this,a.lastInput.documentPoint)}a.animationManager.Tm=!1};
Fe.prototype.doSimulatedDrop=function(){var a=this.diagram,b=Me;if(null!==b){var c=b.diagram;b.rn=!0;Xe(this);if(!this.mayDragIn())return;a.animationManager.Tm=!0;a.S("ChangingSelection",a.selection);this.xa("Drop");vf(this,b.draggedParts.If(),!0,a.lastInput);hf(this,this.copiedParts,!1);null!==this.copiedParts&&(a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}));qf(this,a.lastInput.documentPoint);a.Qa();b=a.selection;null!==this.copiedParts?this.transactionResult=
"ExternalCopy":b=new G;this.copiedParts=null;a.doFocus();a.S("ExternalObjectsDropped",b,c);this.stopTransaction();a.S("ChangedSelection",a.selection)}a.animationManager.Tm=!1};
function vf(a,b,c,d){if(null===a.copiedParts){var e=a.diagram;if(!e.isReadOnly&&!e.isModelReadOnly){e.skipsUndoManager=!c;e.partManager.addsToTemporaryLayer=!c;a.startPoint=d.documentPoint;c=e.Tj(b,e,!0);var f=M.alloc();e=d=Infinity;for(var g=-Infinity,h=-Infinity,k=b.iterator;k.next();){var l=k.value;if(l.isVisible()){var m=l.location;l=m.x;m=m.y;isNaN(l)||isNaN(m)||(l<d&&(d=l),m<e&&(e=m),l>g&&(g=l),m>h&&(h=m))}}Infinity===d?f.h(0,0,0,0):f.h(d,e,g-d,h-e);d=f.x+f.width/2;e=f.y+f.height/2;M.free(f);
f=a.Ur;g=new I;h=J.alloc();for(k=b.iterator;k.next();)l=k.value,l instanceof T&&l.canCopy()&&(m=c.H(l),null!==m&&(m.points=l.points,gf(m,f.x-d,f.y-e),m.suspendsRouting=!0,g.add(m,a.Bd())));for(b=b.iterator;b.next();)l=b.value,l.Nc()&&l.canCopy()&&(k=c.H(l),null!==k&&(l=l.location,h.h(f.x-(d-l.x),f.y-(e-l.y)),k.location=h,k.Ta(),g.add(k,a.Bd(h))));J.free(h);a.copiedParts=g;Ne(a,g.If());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,gf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/
2)));a.doUpdateCursor(null,!0)}}}Fe.prototype.doSimulatedDragOut=function(){var a=this.diagram;a.Vs=!1;this.mayCopy()||this.mayMove()?a.currentCursor="":a.currentCursor=this.nodropCursor;this.co=null};Fe.prototype.computeMove=function(a,b,c,d){c=this.diagram;return null!==c?c.computeMove(a,b,this.dragOptions,d):new J};
na.Object.defineProperties(Fe.prototype,{isCopyEnabled:{get:function(){return this.Rb},set:function(a){this.Rb=a}},copiesEffectiveCollection:{get:function(){return this.D},set:function(a){this.D=a}},dragOptions:{get:function(){return this.Ba},set:function(a){this.Ba=a}},isGridSnapEnabled:{get:function(){return this.dragOptions.isGridSnapEnabled},set:function(a){this.dragOptions.isGridSnapEnabled=
a}},isComplexRoutingRealtime:{get:function(){return this.Gb},set:function(a){this.Gb=a}},isGridSnapRealtime:{get:function(){return this.dragOptions.isGridSnapRealtime},set:function(a){this.dragOptions.isGridSnapRealtime=a}},gridSnapCellSize:{get:function(){return this.dragOptions.gridSnapCellSize},set:function(a){this.dragOptions.gridSnapCellSize.A(a)||(a=a.I(),this.dragOptions.gridSnapCellSize=a)}},gridSnapCellSpot:{
get:function(){return this.dragOptions.gridSnapCellSpot},set:function(a){this.dragOptions.gridSnapCellSpot.A(a)||(a=a.I(),this.dragOptions.gridSnapCellSpot=a)}},gridSnapOrigin:{get:function(){return this.dragOptions.gridSnapOrigin},set:function(a){this.dragOptions.gridSnapOrigin.A(a)||(a=a.I(),this.dragOptions.gridSnapOrigin=a)}},dragsLink:{get:function(){return this.dragOptions.dragsLink},set:function(a){this.dragOptions.dragsLink=
a}},dragsTree:{get:function(){return this.dragOptions.dragsTree},set:function(a){this.dragOptions.dragsTree=a}},copyCursor:{get:function(){return this.L},set:function(a){this.L=a}},moveCursor:{get:function(){return this.Nd},set:function(a){this.Nd=a}},nodropCursor:{get:function(){return this.Od},set:function(a){this.Od=a}},currentPart:{get:function(){return this.wa},
set:function(a){this.wa=a}},copiedParts:{get:function(){return this.o},set:function(a){this.o=a}},draggedParts:{get:function(){return this.Ma},set:function(a){this.Ma=a}},draggingParts:{get:function(){return null!==this.copiedParts?this.copiedParts.If():null!==this.draggedParts?this.draggedParts.If():this.ke}},draggedLink:{get:function(){return this.diagram.draggedLink},set:function(a){this.diagram.draggedLink=
a}},isDragOutStarted:{get:function(){return this.rc},set:function(a){this.rc=a}},startPoint:{get:function(){return this.Ur},set:function(a){this.Ur.A(a)||this.Ur.assign(a)}},delay:{get:function(){return this.Pk},set:function(a){this.Pk=a}}});Fe.prototype.getDraggingSource=Fe.prototype.Yz;var Ve=null,Me=null,Qe=null;Fe.className="DraggingTool";Ve=new F;
Na("draggingTool",function(){return this.findTool("Dragging")},function(a){this.Za("Dragging",a,this.mouseMoveTools)});Pa.prototype.doCancel=function(){null!==Me&&Me.doCancel();te.prototype.doCancel.call(this)};
function wf(){te.call(this);this.Od=100;this.Ba=!1;this.Th="pointer";var a=new T,b=new xf;b.isPanelMain=!0;b.stroke="blue";a.add(b);b=new xf;b.toArrow="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.layerName="Tool";this.$i=a;a=new W;b=new xf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=Hb;a.add(b);a.selectable=!1;a.layerName="Tool";this.Zi=a;this.j=b;a=new W;b=new xf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=
2;b.desiredSize=Hb;a.add(b);a.selectable=!1;a.layerName="Tool";this.rk=a;this.o=b;this.Nd=this.rc=this.Gb=this.Ma=this.Rb=null;this.wa=!0;this.Im=new I;this.ke=this.ii=this.Yi=null}ma(wf,te);wf.prototype.doStop=function(){this.diagram.tg();this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null;this.validPortsCache.clear();this.targetPort=null};
wf.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){var f=b.Af(),g=Fb.alloc();g.width=b.naturalBounds.width*f;g.height=b.naturalBounds.height*f;d.desiredSize=g;Fb.free(g);e?(d.toSpot=b.toSpot,d.toEndSegmentLength=b.toEndSegmentLength):(d.fromSpot=b.fromSpot,d.fromEndSegmentLength=b.fromEndSegmentLength);c.locationSpot=xc;f=J.alloc();c.location=b.da(xc,f);J.free(f);d.angle=b.Ki();null!==this.portTargeted&&this.portTargeted(a,b,c,d,e)}};
wf.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.desiredSize=Hb,b.fromSpot=qc,b.toSpot=qc);null!==a&&(a.location=this.diagram.lastInput.documentPoint);null!==this.portTargeted&&this.portTargeted(null,null,a,b,c)};wf.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()};
wf.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort&&this.targetPort.part instanceof W){var b=this.targetPort.part;this.isForwards?this.copyPortProperties(b,this.targetPort,this.temporaryToNode,this.temporaryToPort,!0):this.copyPortProperties(b,this.targetPort,this.temporaryFromNode,this.temporaryFromPort,!1)}else this.isForwards?this.setNoTargetPortProperties(this.temporaryToNode,this.temporaryToPort,
!0):this.setNoTargetPortProperties(this.temporaryFromNode,this.temporaryFromPort,!1);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.ms(a.lastInput.viewPoint)}};wf.prototype.findValidLinkablePort=function(a,b){if(null===a)return null;var c=a.part;if(!(c instanceof W))return null;for(;null!==a;){var d=b?a.toLinkable:a.fromLinkable;if(!0===d&&(null!==a.portId||a instanceof W)&&(b?this.isValidTo(c,a):this.isValidFrom(c,a)))return a;if(!1===d)break;a=a.panel}return null};
wf.prototype.findTargetPort=function(a){var b=this.diagram,c=b.lastInput.documentPoint,d=this.portGravity;0>=d&&(d=.1);var e=this,f=b.pg(c,d,function(b){return e.findValidLinkablePort(b,a)},null,!0);d=Infinity;b=null;for(f=f.iterator;f.next();){var g=f.value,h=g.part;if(h instanceof W){var k=g.da(xc,J.alloc()),l=c.x-k.x,m=c.y-k.y;J.free(k);k=l*l+m*m;k<d&&(l=this.validPortsCache.H(g),null!==l?l&&(b=g,d=k):a&&this.isValidLink(this.originalFromNode,this.originalFromPort,h,g)||!a&&this.isValidLink(h,
g,this.originalToNode,this.originalToPort)?(this.validPortsCache.add(g,!0),b=g,d=k):this.validPortsCache.add(g,!1))}}return null!==b&&(c=b.part,c instanceof W&&(null===c.layer||c.layer.allowLink))?b:null};
wf.prototype.isValidFrom=function(a,b){if(null===a||null===b)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(null!==a.layer&&!a.layer.allowLink||!0!==b.fromLinkable))return!1;var c=b.fromMaxLinks;if(Infinity>c){if(null!==this.originalLink&&a===this.originalFromNode&&b===this.originalFromPort)return!0;b=b.portId;null===b&&(b="");if(a.Vp(b).count>=c)return!1}return!0};
wf.prototype.isValidTo=function(a,b){if(null===a||null===b)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(null!==a.layer&&!a.layer.allowLink||!0!==b.toLinkable))return!1;var c=b.toMaxLinks;if(Infinity>c){if(null!==this.originalLink&&a===this.originalToNode&&b===this.originalToPort)return!0;b=b.portId;null===b&&(b="");if(a.Gd(b).count>=c)return!1}return!0};
wf.prototype.isInSameNode=function(a,b){if(null===a||null===b)return!1;if(a===b)return!0;a=a.part;b=b.part;return null!==a&&a===b};wf.prototype.isLinked=function(a,b){if(null===a||null===b)return!1;var c=a.part;if(!(c instanceof W))return!1;a=a.portId;null===a&&(a="");var d=b.part;if(!(d instanceof W))return!1;b=b.portId;null===b&&(b="");for(b=d.Gd(b);b.next();)if(d=b.value,d.fromNode===c&&d.fromPortId===a)return!0;return!1};
wf.prototype.isValidLink=function(a,b,c,d){if(!this.isValidFrom(a,b)||!this.isValidTo(c,d)||!(null===b||null===d||(b.fromLinkableSelfNode&&d.toLinkableSelfNode||!this.isInSameNode(b,d))&&(b.fromLinkableDuplicates&&d.toLinkableDuplicates||!this.isLinked(b,d)))||null!==this.originalLink&&(null!==a&&this.isLabelDependentOnLink(a,this.originalLink)||null!==c&&this.isLabelDependentOnLink(c,this.originalLink))||null!==a&&null!==c&&(null===a.data&&null!==c.data||null!==a.data&&null===c.data)||!this.isValidCycle(a,
c,this.originalLink))return!1;if(null!==a){var e=a.linkValidation;if(null!==e&&!e(a,b,c,d,this.originalLink))return!1}if(null!==c&&(e=c.linkValidation,null!==e&&!e(a,b,c,d,this.originalLink)))return!1;e=this.linkValidation;return null!==e?e(a,b,c,d,this.originalLink):!0};wf.prototype.isLabelDependentOnLink=function(a,b){if(null===a)return!1;var c=a.labeledLink;if(null===c)return!1;if(c===b)return!0;var d=new G;d.add(a);return yf(this,c,b,d)};
function yf(a,b,c,d){if(b===c)return!0;var e=b.fromNode;if(null!==e&&e.isLinkLabel&&(d.add(e),yf(a,e.labeledLink,c,d)))return!0;b=b.toNode;return null!==b&&b.isLinkLabel&&(d.add(b),yf(a,b.labeledLink,c,d))?!0:!1}
wf.prototype.isValidCycle=function(a,b,c){void 0===c&&(c=null);if(null===a||null===b)return this.isUnconnectedLinkValid;var d=this.diagram.validCycle;if(d!==zf){if(d===Df){d=c||this.temporaryLink;if(null!==d&&!d.isTreeLink)return!0;for(d=b.linksConnected;d.next();){var e=d.value;if(e!==c&&e.isTreeLink&&e.toNode===b)return!1}return!Ef(this,a,b,c,!0)}if(d===Ff){d=c||this.temporaryLink;if(null!==d&&!d.isTreeLink)return!0;for(d=a.linksConnected;d.next();)if(e=d.value,e!==c&&e.isTreeLink&&e.fromNode===
a)return!1;return!Ef(this,a,b,c,!0)}if(d===Gf)return a===b?a=!0:(d=new G,d.add(b),a=Hf(this,d,a,b,c)),!a;if(d===If)return!Ef(this,a,b,c,!1);if(d===Jf)return a===b?a=!0:(d=new G,d.add(b),a=Kf(this,d,a,b,c)),!a}return!0};function Ef(a,b,c,d,e){if(b===c)return!0;if(null===b||null===c)return!1;for(var f=b.linksConnected;f.next();){var g=f.value;if(g!==d&&(!e||g.isTreeLink)&&g.toNode===b&&(g=g.fromNode,g!==b&&Ef(a,g,c,d,e)))return!0}return!1}
function Hf(a,b,c,d,e){if(c===d)return!0;if(null===c||null===d||b.contains(c))return!1;b.add(c);for(var f=c.linksConnected;f.next();){var g=f.value;if(g!==e&&g.toNode===c&&(g=g.fromNode,g!==c&&Hf(a,b,g,d,e)))return!0}return!1}function Kf(a,b,c,d,e){if(c===d)return!0;if(null===c||null===d||b.contains(c))return!1;b.add(c);for(var f=c.linksConnected;f.next();){var g=f.value;if(g!==e){var h=g.fromNode;g=g.toNode;h=h===c?g:h;if(h!==c&&Kf(a,b,h,d,e))return!0}}return!1}
na.Object.defineProperties(wf.prototype,{portGravity:{get:function(){return this.Od},set:function(a){0<=a&&(this.Od=a)}},isUnconnectedLinkValid:{get:function(){return this.Ba},set:function(a){this.Ba=a}},linkingCursor:{get:function(){return this.Th},set:function(a){this.Th=a}},temporaryLink:{get:function(){return this.$i},set:function(a){this.$i=a}},temporaryFromNode:{
get:function(){return this.Zi},set:function(a){if(this.Zi=a)this.j=a.port}},temporaryFromPort:{get:function(){return this.j},set:function(a){if(null!==this.j){var b=this.j.panel;if(null!==b){var c=b.T.indexOf(this.j);b.eb(c);b.wb(c,a)}}this.j=a}},temporaryToNode:{get:function(){return this.rk},set:function(a){if(this.rk=a)this.o=a.port}},temporaryToPort:{get:function(){return this.o},set:function(a){if(null!==
this.o){var b=this.o.panel;if(null!==b){var c=b.T.indexOf(this.o);b.eb(c);b.wb(c,a)}}this.o=a}},originalLink:{get:function(){return this.Rb},set:function(a){this.Rb=a}},originalFromNode:{get:function(){return this.Ma},set:function(a){this.Ma=a}},originalFromPort:{get:function(){return this.Gb},set:function(a){this.Gb=a}},originalToNode:{get:function(){return this.rc},set:function(a){this.rc=
a}},originalToPort:{get:function(){return this.Nd},set:function(a){this.Nd=a}},isForwards:{get:function(){return this.wa},set:function(a){this.wa=a}},validPortsCache:{get:function(){return this.Im}},targetPort:{get:function(){return this.Yi},set:function(a){this.Yi=a}},linkValidation:{get:function(){return this.ii},set:function(a){this.ii=a}},portTargeted:{
get:function(){return this.ke},set:function(a){this.ke=a}}});wf.className="LinkingBaseTool";function Lf(){wf.call(this);this.name="Linking";this.L={};this.D=null;this.K=Mf;this.Cc=null}ma(Lf,wf);Lf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowLink||!a.model.Cs()||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:null!==this.findLinkablePort()};
Lf.prototype.findLinkablePort=function(){var a=this.diagram,b=this.startObject;null===b&&(b=a.Zb(a.firstInput.documentPoint,null,null));if(null===b)return null;a=b.part;if(!(a instanceof W))return null;var c=this.direction;if(c===Mf||c===Nf){var d=this.findValidLinkablePort(b,!1);if(null!==d||this.startObject===a&&(d=a.port,this.findValidLinkablePort(d,!1)))return this.isForwards=!0,d}if(c===Mf||c===Of)if(b=this.findValidLinkablePort(b,!0),null!==b||this.startObject===a&&(b=a.port,this.findValidLinkablePort(b,
!0)))return this.isForwards=!1,b;return null};
Lf.prototype.doActivate=function(){var a=this.diagram,b=this.findLinkablePort();null===b?this.stopTool():(this.xa(this.name),a.isMouseCaptured=!0,a.currentCursor=this.linkingCursor,this.isForwards?(null===this.temporaryToNode||this.temporaryToNode.location.u()||(this.temporaryToNode.location=a.lastInput.documentPoint),this.originalFromPort=b,b=this.originalFromPort.part,b instanceof W&&(this.originalFromNode=b),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,
this.temporaryFromPort,!1)):(null===this.temporaryFromNode||this.temporaryFromNode.location.u()||(this.temporaryFromNode.location=a.lastInput.documentPoint),this.originalToPort=b,b=this.originalToPort.part,b instanceof W&&(this.originalToNode=b),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0)),a.add(this.temporaryFromNode),a.add(this.temporaryToNode),null!==this.temporaryLink&&(null!==this.temporaryFromNode&&(this.temporaryLink.fromNode=
this.temporaryFromNode),null!==this.temporaryToNode&&(this.temporaryLink.toNode=this.temporaryToNode),this.temporaryLink.isTreeLink=this.isNewTreeLink(),this.temporaryLink.Va(),a.add(this.temporaryLink)),this.isActive=!0)};Lf.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.remove(this.temporaryLink);a.remove(this.temporaryFromNode);a.remove(this.temporaryToNode);a.isMouseCaptured=!1;a.currentCursor="";this.stopTransaction()};
Lf.prototype.doStop=function(){wf.prototype.doStop.call(this);this.startObject=null};
Lf.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=this.transactionResult=null,c=null,d=null,e=null,f=null;try{var g=this.targetPort=this.findTargetPort(this.isForwards);if(null!==g){var h=g.part;h instanceof W&&(this.isForwards?(null!==this.originalFromNode&&(b=this.originalFromNode,c=this.originalFromPort),d=h,e=g):(b=h,c=g,null!==this.originalToNode&&(d=this.originalToNode,e=this.originalToPort)))}else this.isForwards?null!==this.originalFromNode&&this.isUnconnectedLinkValid&&
(b=this.originalFromNode,c=this.originalFromPort):null!==this.originalToNode&&this.isUnconnectedLinkValid&&(d=this.originalToNode,e=this.originalToPort);null!==b||null!==d?(f=this.insertLink(b,c,d,e),null!==f?(null===g&&(this.isForwards?f.defaultToPoint=a.lastInput.documentPoint:f.defaultFromPoint=a.lastInput.documentPoint),a.allowSelect&&(a.S("ChangingSelection",a.selection),a.clearSelection(!0),f.isSelected=!0),this.transactionResult=this.name,a.S("LinkDrawn",f)):this.doNoLink(b,c,d,e)):this.isForwards?
this.doNoLink(this.originalFromNode,this.originalFromPort,null,null):this.doNoLink(null,null,this.originalToNode,this.originalToPort)}finally{this.stopTool(),f&&a.allowSelect&&a.S("ChangedSelection",a.selection)}}};Lf.prototype.isNewTreeLink=function(){var a=this.archetypeLinkData;if(null===a)return!0;if(a instanceof T)return a.isTreeLink;var b=this.diagram;if(null===b)return!0;a=b.partManager.getLinkCategoryForData(a);b=b.partManager.findLinkTemplateForCategory(a);return null!==b?b.isTreeLink:!0};
Lf.prototype.insertLink=function(a,b,c,d){return this.diagram.partManager.insertLink(a,b,c,d)};Lf.prototype.doNoLink=function(){};
na.Object.defineProperties(Lf.prototype,{archetypeLinkData:{get:function(){return this.L},set:function(a){this.L=a}},archetypeLabelNodeData:{get:function(){return this.D},set:function(a){this.D=a}},direction:{get:function(){return this.K},set:function(a){this.K=a}},startObject:{get:function(){return this.Cc},set:function(a){this.Cc=a}}});
var Mf=new D(Lf,"Either",0),Nf=new D(Lf,"ForwardsOnly",0),Of=new D(Lf,"BackwardsOnly",0);Lf.className="LinkingTool";Lf.Either=Mf;Lf.ForwardsOnly=Nf;Lf.BackwardsOnly=Of;
function Re(){wf.call(this);this.name="Relinking";var a=new xf;a.figure="Diamond";a.desiredSize=Jb;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=0;this.L=a;a=new xf;a.figure="Diamond";a.desiredSize=Jb;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=-1;this.Cc=a;this.D=null;this.$w=new M}ma(Re,wf);
Re.prototype.updateAdornments=function(a){if(null!==a&&a instanceof T){var b="RelinkFrom",c=null;if(a.isSelected&&!this.diagram.isReadOnly){var d=a.selectionObject;null!==d&&a.canRelinkFrom()&&a.actualBounds.u()&&a.isVisible()&&d.actualBounds.u()&&d.Ff()&&(c=a.Wj(b),null===c&&(c=this.makeAdornment(d,!1),a.xh(b,c)))}null===c&&a.Gf(b);b="RelinkTo";c=null;a.isSelected&&!this.diagram.isReadOnly&&(d=a.selectionObject,null!==d&&a.canRelinkTo()&&a.actualBounds.u()&&a.isVisible()&&d.actualBounds.u()&&d.Ff()&&
(c=a.Wj(b),null===c?(c=this.makeAdornment(d,!0),a.xh(b,c)):c.s()));null===c&&a.Gf(b)}};Re.prototype.makeAdornment=function(a,b){var c=new ye;c.type=X.Link;b=b?this.toHandleArchetype:this.fromHandleArchetype;null!==b&&c.add(b.copy());c.adornedObject=a;return c};
Re.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowRelink||!a.model.Cs()||!a.lastInput.left)return!1;var b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkFrom");null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkTo"));return null!==b};
Re.prototype.doActivate=function(){var a=this.diagram;if(null===this.originalLink){var b=this.handle;null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkFrom"),null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkTo")));if(null===b)return;var c=b.part;if(!(c instanceof ye&&c.adornedPart instanceof T))return;this.handle=b;this.isForwards=null===c||"RelinkTo"===c.category;this.originalLink=c.adornedPart}this.xa(this.name);a.isMouseCaptured=!0;a.currentCursor=this.linkingCursor;
this.originalFromPort=this.originalLink.fromPort;this.originalFromNode=this.originalLink.fromNode;this.originalToPort=this.originalLink.toPort;this.originalToNode=this.originalLink.toNode;this.$w.set(this.originalLink.actualBounds);null!==this.originalLink&&0<this.originalLink.pointsCount&&(null===this.originalLink.fromNode&&(null!==this.temporaryFromPort&&(this.temporaryFromPort.desiredSize=Gb),null!==this.temporaryFromNode&&(this.temporaryFromNode.location=this.originalLink.i(0))),null===this.originalLink.toNode&&
(null!==this.temporaryToPort&&(this.temporaryToPort.desiredSize=Gb),null!==this.temporaryToNode&&(this.temporaryToNode.location=this.originalLink.i(this.originalLink.pointsCount-1))));this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,!1);this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0);a.add(this.temporaryFromNode);a.add(this.temporaryToNode);null!==this.temporaryLink&&(null!==
this.temporaryFromNode&&(this.temporaryLink.fromNode=this.temporaryFromNode),null!==this.temporaryToNode&&(this.temporaryLink.toNode=this.temporaryToNode),this.copyLinkProperties(this.originalLink,this.temporaryLink),this.temporaryLink.Va(),a.add(this.temporaryLink));this.isActive=!0};
Re.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.adjusting=a.adjusting;b.corner=a.corner;var c=a.curve;if(c===Pf||c===Qf)c=Rf;b.curve=c;b.curviness=a.curviness;b.isTreeLink=a.isTreeLink;b.points=a.points;b.routing=a.routing;b.smoothness=a.smoothness;b.fromSpot=a.fromSpot;b.fromEndSegmentLength=a.fromEndSegmentLength;b.fromShortLength=a.fromShortLength;b.toSpot=a.toSpot;b.toEndSegmentLength=a.toEndSegmentLength;b.toShortLength=a.toShortLength}};
Re.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.remove(this.temporaryLink);a.remove(this.temporaryFromNode);a.remove(this.temporaryToNode);a.isMouseCaptured=!1;a.currentCursor="";this.stopTransaction()};Re.prototype.doStop=function(){wf.prototype.doStop.call(this);this.handle=null};
Re.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;this.transactionResult=null;var b=this.originalFromNode,c=this.originalFromPort,d=this.originalToNode,e=this.originalToPort,f=this.originalLink;try{this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort){var g=this.targetPort.part;g instanceof W&&(this.isForwards?(d=g,e=this.targetPort):(b=g,c=this.targetPort))}else this.isUnconnectedLinkValid?this.isForwards?e=d=null:c=b=null:f=null;null!==f?(this.reconnectLink(f,
this.isForwards?d:b,this.isForwards?e:c,this.isForwards),null===this.targetPort&&(this.isForwards?f.defaultToPoint=a.lastInput.documentPoint:f.defaultFromPoint=a.lastInput.documentPoint,f.Va()),this.transactionResult=this.name,a.S("LinkRelinked",f,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards);this.originalLink.eq(this.$w)}finally{this.stopTool()}}};
Re.prototype.reconnectLink=function(a,b,c,d){c=null!==c&&null!==c.portId?c.portId:"";d?(a.toNode=b,a.toPortId=c):(a.fromNode=b,a.fromPortId=c);return!0};Re.prototype.doNoRelink=function(){};
function pf(a,b,c,d,e){null!==b?(a.copyPortProperties(b,c,a.temporaryFromNode,a.temporaryFromPort,!1),a.diagram.add(a.temporaryFromNode)):a.diagram.remove(a.temporaryFromNode);null!==d?(a.copyPortProperties(d,e,a.temporaryToNode,a.temporaryToPort,!0),a.diagram.add(a.temporaryToNode)):a.diagram.remove(a.temporaryToNode)}
na.Object.defineProperties(Re.prototype,{fromHandleArchetype:{get:function(){return this.L},set:function(a){this.L=a}},toHandleArchetype:{get:function(){return this.Cc},set:function(a){this.Cc=a}},handle:{get:function(){return this.D},set:function(a){if(null!==a&&!(a.part instanceof ye))throw Error("new handle is not in an Adornment: "+a);this.D=a}}});Re.className="RelinkingTool";
Na("linkingTool",function(){return this.findTool("Linking")},function(a){this.Za("Linking",a,this.mouseMoveTools)});Na("relinkingTool",function(){return this.findTool("Relinking")},function(a){this.Za("Relinking",a,this.mouseDownTools)});
function Sf(){te.call(this);this.name="LinkReshaping";var a=new xf;a.figure="Rectangle";a.desiredSize=Ib;a.fill="lightblue";a.stroke="dodgerblue";this.o=a;a=new xf;a.figure="Diamond";a.desiredSize=Jb;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="move";this.D=a;this.L=3;this.ot=this.j=null;this.ax=new J;this.Fr=new F}ma(Sf,te);Sf.prototype.Vu=function(a){return a&&a.Jr&&0!==a.Jr.value?a.Jr:Tf};Sf.prototype.ym=function(a,b){a.Jr=b};
Sf.prototype.updateAdornments=function(a){if(null!==a&&a instanceof T){var b=null;if(a.isSelected&&!this.diagram.isReadOnly){var c=a.path;null!==c&&a.canReshape()&&a.actualBounds.u()&&a.isVisible()&&c.actualBounds.u()&&c.Ff()&&(b=a.Wj(this.name),null===b||b.Ww!==a.pointsCount||b.qx!==a.resegmentable)&&(b=this.makeAdornment(c),null!==b&&(b.Ww=a.pointsCount,b.qx=a.resegmentable,a.xh(this.name,b)))}null===b&&a.Gf(this.name)}};
Sf.prototype.makeAdornment=function(a){var b=a.part,c=b.pointsCount,d=b.isOrthogonal,e=null;if(null!==b.points&&1<c){e=new ye;e.type=X.Link;c=b.firstPickIndex;var f=b.lastPickIndex,g=d?1:0;if(b.resegmentable&&b.computeCurve()!==Uf)for(var h=c+g;h<f-g;h++){var k=this.makeResegmentHandle(a,h);null!==k&&(k.segmentIndex=h,k.segmentFraction=.5,k.fromMaxLinks=999,e.add(k))}for(g=c+1;g<f;g++)if(h=this.makeHandle(a,g),null!==h){h.segmentIndex=g;if(g!==c)if(g===c+1&&d){k=b.i(c);var l=b.i(c+1);L.w(k.x,l.x)&&
L.w(k.y,l.y)&&(l=b.i(c-1));L.w(k.x,l.x)?(this.ym(h,Vf),h.cursor="n-resize"):L.w(k.y,l.y)&&(this.ym(h,Wf),h.cursor="w-resize")}else g===f-1&&d?(k=b.i(f-1),l=b.i(f),L.w(k.x,l.x)&&L.w(k.y,l.y)&&(k=b.i(f+1)),L.w(k.x,l.x)?(this.ym(h,Vf),h.cursor="n-resize"):L.w(k.y,l.y)&&(this.ym(h,Wf),h.cursor="w-resize")):g!==f&&(this.ym(h,Xf),h.cursor="move");e.add(h)}e.adornedObject=a}return e};Sf.prototype.makeHandle=function(){var a=this.handleArchetype;return null===a?null:a.copy()};
Sf.prototype.makeResegmentHandle=function(){var a=this.midHandleArchetype;return null===a?null:a.copy()};Sf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowReshape&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
Sf.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null!==this.handle){var b=this.handle.part.adornedPart;if(b instanceof T){this.ot=b;a.isMouseCaptured=!0;this.xa(this.name);if(b.resegmentable&&999===this.handle.fromMaxLinks){var c=b.points.copy(),d=this.getResegmentingPoint();c.wb(this.handle.segmentIndex+1,d);b.isOrthogonal&&c.wb(this.handle.segmentIndex+1,d);b.points=c;b.Lb();b.updateAdornments();
this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name);if(null===this.handle){this.doDeactivate();return}}this.ax=b.i(this.handle.segmentIndex);this.Fr=b.points.copy();this.isActive=!0}}};Sf.prototype.doDeactivate=function(){this.stopTransaction();this.ot=this.handle=null;this.isActive=this.diagram.isMouseCaptured=!1};Sf.prototype.doCancel=function(){var a=this.adornedLink;null!==a&&(a.points=this.Fr);this.stopTool()};Sf.prototype.getResegmentingPoint=function(){return this.handle.da(xc)};
Sf.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeReshape(a.lastInput.documentPoint),this.reshape(a))};
Sf.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.computeReshape(a.lastInput.documentPoint);this.reshape(b);b=this.adornedLink;if(null!==b&&b.resegmentable){var c=this.handle.segmentIndex,d=b.i(c-1),e=b.i(c),f=b.i(c+1);if(b.isOrthogonal){if(c>b.firstPickIndex+1&&c<b.lastPickIndex-1){var g=b.i(c-2);if(Math.abs(d.x-e.x)<this.resegmentingDistance&&Math.abs(d.y-e.y)<this.resegmentingDistance&&(Yf(this,g,d,e,f,!0)||Yf(this,g,d,e,f,!1))){var h=b.points.copy();Yf(this,g,d,
e,f,!0)?(h.Pc(c-2,new J(g.x,(f.y+g.y)/2)),h.Pc(c+1,new J(f.x,(f.y+g.y)/2))):(h.Pc(c-2,new J((f.x+g.x)/2,g.y)),h.Pc(c+1,new J((f.x+g.x)/2,f.y)));h.eb(c);h.eb(c-1);b.points=h;b.Lb()}else g=b.i(c+2),Math.abs(e.x-f.x)<this.resegmentingDistance&&Math.abs(e.y-f.y)<this.resegmentingDistance&&(Yf(this,d,e,f,g,!0)||Yf(this,d,e,f,g,!1))&&(h=b.points.copy(),Yf(this,d,e,f,g,!0)?(h.Pc(c-1,new J(d.x,(d.y+g.y)/2)),h.Pc(c+2,new J(g.x,(d.y+g.y)/2))):(h.Pc(c-1,new J((d.x+g.x)/2,d.y)),h.Pc(c+2,new J((d.x+g.x)/2,g.y))),
h.eb(c+1),h.eb(c),b.points=h,b.Lb())}}else g=J.alloc(),L.Ih(d.x,d.y,f.x,f.y,e.x,e.y,g)&&g.xf(e)<this.resegmentingDistance*this.resegmentingDistance&&(d=b.points.copy(),d.eb(c),b.points=d,b.Lb()),J.free(g)}a.Qa();this.transactionResult=this.name;a.S("LinkReshaped",this.adornedLink,this.Fr)}this.stopTool()};
function Yf(a,b,c,d,e,f){return f?Math.abs(b.y-c.y)<a.resegmentingDistance&&Math.abs(c.y-d.y)<a.resegmentingDistance&&Math.abs(d.y-e.y)<a.resegmentingDistance:Math.abs(b.x-c.x)<a.resegmentingDistance&&Math.abs(c.x-d.x)<a.resegmentingDistance&&Math.abs(d.x-e.x)<a.resegmentingDistance}
Sf.prototype.reshape=function(a){var b=this.adornedLink;b.Lh();var c=this.handle.segmentIndex,d=this.Vu(this.handle);if(b.isOrthogonal)if(c===b.firstPickIndex+1)c=b.firstPickIndex+1,d===Vf?(b.M(c,b.i(c-1).x,a.y),b.M(c+1,b.i(c+2).x,a.y)):d===Wf&&(b.M(c,a.x,b.i(c-1).y),b.M(c+1,a.x,b.i(c+2).y));else if(c===b.lastPickIndex-1)c=b.lastPickIndex-1,d===Vf?(b.M(c-1,b.i(c-2).x,a.y),b.M(c,b.i(c+1).x,a.y)):d===Wf&&(b.M(c-1,a.x,b.i(c-2).y),b.M(c,a.x,b.i(c+1).y));else{d=c;var e=b.i(d),f=b.i(d-1),g=b.i(d+1);L.w(f.x,
e.x)&&L.w(e.y,g.y)?(L.w(f.x,b.i(d-2).x)&&!L.w(f.y,b.i(d-2).y)?(b.l(d,a.x,f.y),c++,d++):b.M(d-1,a.x,f.y),L.w(g.y,b.i(d+2).y)&&!L.w(g.x,b.i(d+2).x)?b.l(d+1,g.x,a.y):b.M(d+1,g.x,a.y)):L.w(f.y,e.y)&&L.w(e.x,g.x)?(L.w(f.y,b.i(d-2).y)&&!L.w(f.x,b.i(d-2).x)?(b.l(d,f.x,a.y),c++,d++):b.M(d-1,f.x,a.y),L.w(g.x,b.i(d+2).x)&&!L.w(g.y,b.i(d+2).y)?b.l(d+1,a.x,g.y):b.M(d+1,a.x,g.y)):L.w(f.x,e.x)&&L.w(e.x,g.x)?(L.w(f.x,b.i(d-2).x)&&!L.w(f.y,b.i(d-2).y)?(b.l(d,a.x,f.y),c++,d++):b.M(d-1,a.x,f.y),L.w(g.x,b.i(d+2).x)&&
!L.w(g.y,b.i(d+2).y)?b.l(d+1,a.x,g.y):b.M(d+1,a.x,g.y)):L.w(f.y,e.y)&&L.w(e.y,g.y)&&(L.w(f.y,b.i(d-2).y)&&!L.w(f.x,b.i(d-2).x)?(b.l(d,f.x,a.y),c++,d++):b.M(d-1,f.x,a.y),L.w(g.y,b.i(d+2).y)&&!L.w(g.x,b.i(d+2).x)?b.l(d+1,g.x,a.y):b.M(d+1,g.x,a.y));b.M(c,a.x,a.y)}else b.M(c,a.x,a.y),d=b.fromNode,e=b.fromPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),1===c&&b.computeSpot(!0,e).Ac()&&(f=e.da(xc,J.alloc()),d=b.getLinkPointFromPoint(d,e,f,a,!0,J.alloc()),b.M(0,d.x,d.y),J.free(f),
J.free(d)),d=b.toNode,e=b.toPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),c===b.pointsCount-2&&b.computeSpot(!1,e).Ac()&&(c=e.da(xc,J.alloc()),a=b.getLinkPointFromPoint(d,e,c,a,!1,J.alloc()),b.M(b.pointsCount-1,a.x,a.y),J.free(c),J.free(a));b.vf()};Sf.prototype.computeReshape=function(a){var b=this.adornedLink,c=this.handle.segmentIndex;switch(this.Vu(this.handle)){case Xf:return a;case Vf:return new J(b.i(c).x,a.y);case Wf:return new J(a.x,b.i(c).y);default:case Tf:return b.i(c)}};
na.Object.defineProperties(Sf.prototype,{handleArchetype:{get:function(){return this.o},set:function(a){this.o=a}},midHandleArchetype:{get:function(){return this.D},set:function(a){this.D=a}},handle:{get:function(){return this.j},set:function(a){if(null!==a&&!(a.part instanceof ye))throw Error("new handle is not in an Adornment: "+a);this.j=a}},adornedLink:{get:function(){return this.ot}},
resegmentingDistance:{get:function(){return this.L},set:function(a){this.L=a}},originalPoint:{get:function(){return this.ax}},originalPoints:{get:function(){return this.Fr}}});Sf.prototype.setReshapingBehavior=Sf.prototype.ym;Sf.prototype.getReshapingBehavior=Sf.prototype.Vu;var Tf=new D(Sf,"None",0),Wf=new D(Sf,"Horizontal",1),Vf=new D(Sf,"Vertical",2),Xf=new D(Sf,"All",3);Sf.className="LinkReshapingTool";
Sf.None=Tf;Sf.Horizontal=Wf;Sf.Vertical=Vf;Sf.All=Xf;Na("linkReshapingTool",function(){return this.findTool("LinkReshaping")},function(a){this.Za("LinkReshaping",a,this.mouseDownTools)});
function Zf(){te.call(this);this.name="Resizing";this.Zf=(new Fb(1,1)).freeze();this.Yf=(new Fb(9999,9999)).freeze();this.yg=(new Fb(NaN,NaN)).freeze();this.D=!1;this.L=!0;this.le=null;var a=new xf;a.alignmentFocus=xc;a.figure="Rectangle";a.desiredSize=Ib;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.o=a;this.j=null;this.Er=new J;this.Zw=new Fb;this.Io=new J;this.Dt=new Fb(0,0);this.Ct=new Fb(Infinity,Infinity);this.Bt=new Fb(1,1)}ma(Zf,te);
Zf.prototype.updateAdornments=function(a){if(!(null===a||a instanceof T)){if(a.isSelected&&!this.diagram.isReadOnly){var b=a.resizeObject,c=a.Wj(this.name);if(null!==b&&a.canResize()&&a.actualBounds.u()&&a.isVisible()&&b.actualBounds.u()&&b.Ff()){if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){b=b.Ki();lg(a)&&this.updateResizeHandles(c,b);a.xh(this.name,c);return}}}a.Gf(this.name)}};
Zf.prototype.makeAdornment=function(a){var b=a.part.resizeAdornmentTemplate;if(null===b){b=new ye;b.type=X.Spot;b.locationSpot=xc;var c=new mg;c.isPanelMain=!0;b.add(c);b.add(this.makeHandle(a,tc));b.add(this.makeHandle(a,vc));b.add(this.makeHandle(a,Bc));b.add(this.makeHandle(a,zc));b.add(this.makeHandle(a,$c));b.add(this.makeHandle(a,bd));b.add(this.makeHandle(a,cd));b.add(this.makeHandle(a,ad))}else if(ng(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};
Zf.prototype.makeHandle=function(a,b){a=this.handleArchetype;if(null===a)return null;a=a.copy();a.alignment=b;return a};
Zf.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.Mb()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.Ac()&&(c=xc);if(0>=c.x)b=0>=c.y?b+225:1<=c.y?b+135:b+180;else if(1<=c.x)0>=c.y?b+=315:1<=c.y&&(b+=45);else if(0>=c.y)b+=270;else if(1<=c.y)b+=90;else break a;0>b?b+=360:360<=b&&(b-=360);a.cursor=22.5>b?"e-resize":67.5>b?"se-resize":112.5>b?"s-resize":157.5>b?"sw-resize":202.5>b?"w-resize":247.5>b?"nw-resize":292.5>b?"n-resize":337.5>b?"ne-resize":
"e-resize"}else if(a instanceof X)for(a=a.elements;a.next();)this.updateResizeHandles(a.value,b)};Zf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowResize&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
Zf.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));null!==this.handle&&(this.adornedObject=this.handle.part.adornedObject,null!==this.adornedObject&&(a.isMouseCaptured=!0,a.animationManager.qc(),this.xa(this.name),this.Er.set(this.adornedObject.da(this.handle.alignment.pv())),this.Io.set(this.adornedObject.part.location),this.Zw.set(this.adornedObject.desiredSize),this.Bt=this.computeCellSize(),this.Dt=
this.computeMinSize(),this.Ct=this.computeMaxSize(),this.isActive=!0))};Zf.prototype.doDeactivate=function(){var a=this.diagram;this.stopTransaction();this.le=this.handle=null;this.isActive=a.isMouseCaptured=!1};Zf.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation);this.stopTool()};
Zf.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive){var b=this.Dt,c=this.Ct,d=this.Bt,e=this.adornedObject.us(a.lastInput.documentPoint,J.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.hd();J.free(e)}};
Zf.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.Dt,c=this.Ct,d=this.Bt,e=this.adornedObject.us(a.lastInput.documentPoint,J.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);J.free(e);a.Qa();this.transactionResult=this.name;a.S("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()};
Zf.prototype.resize=function(a){var b=this.diagram,c=this.adornedObject;if(null!==c){c.desiredSize=a.size;a=c.part;a.Ta();c=c.da(this.handle.alignment.pv());if(a instanceof U){var d=new F;d.add(a);if(!this.dragsMembers&&null===a.placeholder){var e=new Le;e.dragsMembers=!1}b.moveParts(d,this.oppositePoint.copy().ie(c),!0,e)}else a.location=a.location.copy().ie(c).add(this.oppositePoint);b.hd()}};
Zf.prototype.computeResize=function(a,b,c,d,e,f){b.Ac()&&(b=xc);var g=this.adornedObject.naturalBounds,h=g.x,k=g.y,l=g.x+g.width,m=g.y+g.height,n=1;if(!f){n=g.width;var p=g.height;0>=n&&(n=1);0>=p&&(p=1);n=p/n}p=J.alloc();L.Wp(a.x,a.y,h,k,e.width,e.height,p);a=g.copy();0>=b.x?0>=b.y?(a.x=Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=Math.max(l-a.x,c.width),a.y=Math.max(p.y,m-d.height),a.y=Math.min(a.y,m-c.height),a.height=Math.max(m-a.y,c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*
a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),a.x=l-a.width,a.y=m-a.height)):1<=b.y?(a.x=Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=Math.max(l-a.x,c.width),a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),a.x=l-a.width)):(a.x=
Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=l-a.x,f||(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n,a.y=k+.5*(m-k-a.height))):1<=b.x?0>=b.y?(a.width=Math.max(Math.min(p.x-h,d.width),c.width),a.y=Math.max(p.y,m-d.height),a.y=Math.min(a.y,m-c.height),a.height=Math.max(m-a.y,c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),
a.y=m-a.height)):1<=b.y?(a.width=Math.max(Math.min(p.x-h,d.width),c.width),a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width))):(a.width=Math.max(Math.min(p.x-h,d.width),c.width),f||(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n,a.y=k+.5*(m-k-a.height))):0>=b.y?(a.y=Math.max(p.y,m-d.height),
a.y=Math.min(a.y,m-c.height),a.height=m-a.y,f||(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width,a.x=h+.5*(l-h-a.width))):1<=b.y&&(a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width,a.x=h+.5*(l-h-a.width)));J.free(p);return a};Zf.prototype.computeReshape=function(){var a=og;this.adornedObject instanceof xf&&(a=pg(this.adornedObject));return!(a===qg||this.diagram.lastInput.shift)};
Zf.prototype.computeMinSize=function(){var a=this.adornedObject.minSize.copy(),b=this.minSize;!isNaN(b.width)&&b.width>a.width&&(a.width=b.width);!isNaN(b.height)&&b.height>a.height&&(a.height=b.height);return a};Zf.prototype.computeMaxSize=function(){var a=this.adornedObject.maxSize.copy(),b=this.maxSize;!isNaN(b.width)&&b.width<a.width&&(a.width=b.width);!isNaN(b.height)&&b.height<a.height&&(a.height=b.height);return a};
Zf.prototype.computeCellSize=function(){var a=new Fb(NaN,NaN),b=this.adornedObject.part;null!==b&&(b=b.resizeCellSize,!isNaN(b.width)&&0<b.width&&(a.width=b.width),!isNaN(b.height)&&0<b.height&&(a.height=b.height));b=this.cellSize;isNaN(a.width)&&!isNaN(b.width)&&0<b.width&&(a.width=b.width);isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height);b=this.diagram;(isNaN(a.width)||isNaN(a.height))&&b&&(b=b.grid,null!==b&&b.visible&&this.isGridSnapEnabled&&(b=b.gridCellSize,isNaN(a.width)&&
!isNaN(b.width)&&0<b.width&&(a.width=b.width),isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height)));if(isNaN(a.width)||0===a.width||Infinity===a.width)a.width=1;if(isNaN(a.height)||0===a.height||Infinity===a.height)a.height=1;return a};
na.Object.defineProperties(Zf.prototype,{handleArchetype:{get:function(){return this.o},set:function(a){this.o=a}},handle:{get:function(){return this.j},set:function(a){if(null!==a&&!(a.part instanceof ye))throw Error("new handle is not in an Adornment: "+a);this.j=a}},adornedObject:{get:function(){return this.le},set:function(a){if(null!==a&&a.part instanceof ye)throw Error("new handle must not be in an Adornment: "+
a);this.le=a}},minSize:{get:function(){return this.Zf},set:function(a){if(!this.Zf.A(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.Zf.h(b,a)}}},maxSize:{get:function(){return this.Yf},set:function(a){if(!this.Yf.A(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity);this.Yf.h(b,a)}}},cellSize:{get:function(){return this.yg},set:function(a){this.yg.A(a)||this.yg.assign(a)}},
isGridSnapEnabled:{get:function(){return this.D},set:function(a){this.D=a}},dragsMembers:{get:function(){return this.L},set:function(a){this.L=a}},oppositePoint:{get:function(){return this.Er},set:function(a){this.Er.A(a)||this.Er.assign(a)}},originalDesiredSize:{get:function(){return this.Zw}},originalLocation:{get:function(){return this.Io}}});
Zf.className="ResizingTool";Na("resizingTool",function(){return this.findTool("Resizing")},function(a){this.Za("Resizing",a,this.mouseDownTools)});function rg(){te.call(this);this.name="Rotating";this.Ba=45;this.wa=2;this.Io=new J;this.le=null;var a=new xf;a.figure="Ellipse";a.desiredSize=Jb;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.o=a;this.j=null;this.Yw=0;this.Kr=new J(NaN,NaN);this.D=0;this.L=50}ma(rg,te);
rg.prototype.updateAdornments=function(a){if(null!==a){if(a.Hh()){var b=a.rotateObject;if(b===a||b===a.path||b.isPanelMain)return}if(a.isSelected&&!this.diagram.isReadOnly&&(b=a.rotateObject,null!==b&&a.canRotate()&&a.actualBounds.u()&&a.isVisible()&&b.actualBounds.u()&&b.Ff())){var c=a.Wj(this.name);if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.Ki();null===c.placeholder&&(c.location=this.computeAdornmentLocation(b));a.xh(this.name,c);return}}a.Gf(this.name)}};
rg.prototype.makeAdornment=function(a){var b=a.part.rotateAdornmentTemplate;if(null===b){b=new ye;b.type=X.Position;b.locationSpot=xc;var c=this.handleArchetype;null!==c&&b.add(c.copy())}else if(ng(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};rg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowRotate&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
rg.prototype.doActivate=function(){var a=this.diagram;if(null===this.adornedObject){null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null===this.handle)return;this.adornedObject=this.handle.part.adornedObject}null!==this.adornedObject&&(a.isMouseCaptured=!0,a.delaysLayout=!0,this.xa(this.name),this.Yw=this.adornedObject.angle,this.Kr=this.computeRotationPoint(this.adornedObject),this.Io=this.adornedObject.part.location.copy(),this.isActive=!0)};
rg.prototype.computeRotationPoint=function(a){var b=a.part,c=b.locationObject;return b.rotationSpot.hb()?a.da(b.rotationSpot):a===b||a===c?c.da(b.locationSpot):a.da(xc)};
rg.prototype.computeAdornmentLocation=function(a){var b=this.rotationPoint;b.u()||(b=this.computeRotationPoint(a));b=a.us(b);var c=this.handleAngle;0>c?c+=360:360<=c&&(c-=360);c=Math.round(45*Math.round(c/45));var d=this.handleDistance;0===c?b.x=a.naturalBounds.width+d:45===c?(b.x=a.naturalBounds.width+d,b.y=a.naturalBounds.height+d):90===c?b.y=a.naturalBounds.height+d:135===c?(b.x=-d,b.y=a.naturalBounds.height+d):180===c?b.x=-d:225===c?(b.x=-d,b.y=-d):270===c?b.y=-d:315===c&&(b.x=a.naturalBounds.width+
d,b.y=-d);return a.da(b)};rg.prototype.doDeactivate=function(){var a=this.diagram;this.stopTransaction();this.le=this.handle=null;this.Kr=new J(NaN,NaN);this.isActive=a.isMouseCaptured=!1};rg.prototype.doCancel=function(){this.diagram.delaysLayout=!1;this.rotate(this.originalAngle);this.stopTool()};rg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeRotate(a.lastInput.documentPoint),this.rotate(a))};
rg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){a.delaysLayout=!1;var b=this.computeRotate(a.lastInput.documentPoint);this.rotate(b);a.Qa();this.transactionResult=this.name;a.S("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()};
rg.prototype.rotate=function(a){var b=this.adornedObject;if(null!==b){b.angle=a;b=b.part;b.Ta();var c=b.locationObject,d=b.rotateObject;if(c===d||c.rg(d))c=this.Io.copy(),b.location=c.ie(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint);this.diagram.hd()}};
rg.prototype.computeRotate=function(a){a=this.rotationPoint.Pa(a)-this.handleAngle;var b=this.adornedObject.panel;null!==b&&(a-=b.Ki());360<=a?a-=360:0>a&&(a+=360);b=Math.min(Math.abs(this.snapAngleMultiple),180);var c=Math.min(Math.abs(this.snapAngleEpsilon),b/2);!this.diagram.lastInput.shift&&0<b&&0<c&&(a%b<c?a=Math.floor(a/b)*b:a%b>b-c&&(a=(Math.floor(a/b)+1)*b));360<=a?a-=360:0>a&&(a+=360);return a};
na.Object.defineProperties(rg.prototype,{handleArchetype:{get:function(){return this.o},set:function(a){this.o=a}},handle:{get:function(){return this.j},set:function(a){if(null!==a&&!(a.part instanceof ye))throw Error("new handle is not in an Adornment: "+a);this.j=a}},adornedObject:{get:function(){return this.le},set:function(a){if(null!==a&&a.part instanceof ye)throw Error("new handle must not be in an Adornment: "+
a);this.le=a}},snapAngleMultiple:{get:function(){return this.Ba},set:function(a){this.Ba=a}},snapAngleEpsilon:{get:function(){return this.wa},set:function(a){this.wa=a}},originalAngle:{get:function(){return this.Yw}},rotationPoint:{get:function(){return this.Kr},set:function(a){this.Kr=a.copy()}},handleAngle:{get:function(){return this.D},set:function(a){this.D=
a}},handleDistance:{get:function(){return this.L},set:function(a){this.L=a}}});rg.className="RotatingTool";Na("rotatingTool",function(){return this.findTool("Rotating")},function(a){this.Za("Rotating",a,this.mouseDownTools)});function sg(){te.call(this);this.name="ClickSelecting"}ma(sg,te);sg.prototype.canStart=function(){return!this.isEnabled||this.isBeyondDragSize()?!1:!0};
sg.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip());this.stopTool()};sg.className="ClickSelectingTool";function tg(){te.call(this);this.name="Action";this.tk=null}ma(tg,te);
tg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram,b=a.lastInput,c=a.Zb(b.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a});if(null!==c){if(!c.isActionable)return!1;this.tk=c;a.Jk=a.Zb(b.documentPoint,null,null);return!0}return!1};tg.prototype.doMouseDown=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.tk;null!==b&&(a.targetObject=b,null!==b.actionDown&&b.actionDown(a,b))}else this.canStart()&&this.doActivate()};
tg.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.tk;null!==b&&(a.targetObject=b,null!==b.actionMove&&b.actionMove(a,b))}};tg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.tk;if(null===b)return;a.targetObject=b;null!==b.actionUp&&b.actionUp(a,b);this.standardMouseClick(function(a){for(;null!==a.panel&&(!a.isActionable||a!==b);)a=a.panel;return a},function(a){return a===b})}this.stopTool()};
tg.prototype.doCancel=function(){var a=this.diagram.lastInput,b=this.tk;null!==b&&(a.targetObject=b,null!==b.actionCancel&&b.actionCancel(a,b),this.stopTool())};tg.prototype.doStop=function(){this.tk=null};tg.className="ActionTool";function ug(){te.call(this);this.name="ClickCreating";this.bj=null;this.o=!0;this.j=!1;this.Lw=new J(0,0)}ma(ug,te);
ug.prototype.canStart=function(){if(!this.isEnabled||null===this.archetypeNodeData)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.lastInput.left||this.isBeyondDragSize())return!1;if(this.isDoubleClick){if(1===a.lastInput.clickCount&&(this.Lw=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.Lw))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.Zl(a.lastInput.documentPoint,!0)?!1:!0};
ug.prototype.doMouseUp=function(){var a=this.diagram;this.isActive&&this.insertPart(a.lastInput.documentPoint);this.stopTool()};
ug.prototype.insertPart=function(a){var b=this.diagram,c=this.archetypeNodeData;if(null===c)return null;var d=null;try{b.S("ChangingSelection",b.selection);this.xa(this.name);if(c instanceof V)c.Nc()&&(ng(c),d=c.copy(),null!==d&&b.add(d));else if(null!==c){var e=b.model.copyNodeData(c);za(e)&&(b.model.sf(e),d=b.zc(e))}if(null!==d){var f=J.allocAt(a.x,a.y);this.isGridSnapEnabled&&vg(this.diagram,d,a,f);d.location=f;b.allowSelect&&(b.clearSelection(!0),d.isSelected=!0);J.free(f)}b.Qa();this.transactionResult=
this.name;b.S("PartCreated",d)}finally{this.stopTransaction(),b.S("ChangedSelection",b.selection)}return d};na.Object.defineProperties(ug.prototype,{archetypeNodeData:{get:function(){return this.bj},set:function(a){this.bj=a}},isDoubleClick:{get:function(){return this.o},set:function(a){this.o=a}},isGridSnapEnabled:{get:function(){return this.j},set:function(a){this.j=a}}});ug.className="ClickCreatingTool";
function wg(){te.call(this);this.name="DragSelecting";this.Pk=175;this.o=!1;var a=new V;a.layerName="Tool";a.selectable=!1;var b=new xf;b.name="SHAPE";b.figure="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.j=a}ma(wg,te);
wg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(!a.allowSelect)return!1;var b=a.lastInput;return!b.left||a.currentTool!==this&&(!this.isBeyondDragSize()||b.timestamp-a.firstInput.timestamp<this.delay||null!==a.Zl(b.documentPoint,!0))?!1:!0};wg.prototype.doActivate=function(){var a=this.diagram;this.isActive=!0;a.isMouseCaptured=!0;a.skipsUndoManager=!0;a.add(this.box);this.doMouseMove()};
wg.prototype.doDeactivate=function(){var a=this.diagram;a.tg();a.remove(this.box);a.skipsUndoManager=!1;this.isActive=a.isMouseCaptured=!1};wg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive&&null!==this.box){var b=this.computeBoxBounds(),c=this.box.Ya("SHAPE");null===c&&(c=this.box.pb());var d=Fb.alloc().h(b.width,b.height);c.desiredSize=d;this.box.wm(b.x,b.y,!1);Fb.free(d);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.ms(a.lastInput.viewPoint)}};
wg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;a.remove(this.box);try{a.currentCursor="wait",a.S("ChangingSelection",a.selection),this.selectInRect(this.computeBoxBounds()),a.S("ChangedSelection",a.selection)}finally{a.currentCursor=""}}this.stopTool()};wg.prototype.computeBoxBounds=function(){var a=this.diagram;return new M(a.firstInput.documentPoint,a.lastInput.documentPoint)};
wg.prototype.selectInRect=function(a){var b=this.diagram,c=b.lastInput;a=b.Px(a,this.isPartialInclusion);if(Ta?c.meta:c.control)if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected&&(b.isSelected=!1);else for(a=a.iterator;a.next();)b=a.value,b.isSelected=!b.isSelected;else if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0);else{c=new F;for(b=b.selection.iterator;b.next();){var d=b.value;a.contains(d)||c.add(d)}for(b=c.iterator;b.next();)b.value.isSelected=!1;for(a=
a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0)}};na.Object.defineProperties(wg.prototype,{delay:{get:function(){return this.Pk},set:function(a){this.Pk=a}},isPartialInclusion:{get:function(){return this.o},set:function(a){this.o=a}},box:{get:function(){return this.j},set:function(a){this.j=a}}});wg.className="DragSelectingTool";
function xg(){te.call(this);this.name="Panning";this.Vt=new J;this.Vy=new J;this.xg=!1;var a=this;this.hx=function(){var b=a.diagram;null!==b&&b.removeEventListener(x.document,"scroll",a.hx,!1);a.stopTool()}}ma(xg,te);xg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.allowHorizontalScroll&&!a.allowVerticalScroll||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:!0};
xg.prototype.doActivate=function(){var a=this.diagram;this.xg?(a.lastInput.bubbles=!0,a.addEventListener(x.document,"scroll",this.hx,!1)):(a.currentCursor="move",a.isMouseCaptured=!0,this.Vt.assign(a.position));this.isActive=!0};xg.prototype.doDeactivate=function(){var a=this.diagram;a.currentCursor="";this.isActive=a.isMouseCaptured=!1};xg.prototype.doCancel=function(){var a=this.diagram;a.position=this.Vt;a.isMouseCaptured=!1;this.stopTool()};xg.prototype.doMouseMove=function(){this.move()};
xg.prototype.doMouseUp=function(){this.move();this.stopTool()};xg.prototype.move=function(){var a=this.diagram;if(this.isActive&&a)if(this.xg)a.lastInput.bubbles=!0;else{var b=a.position,c=a.firstInput.documentPoint,d=a.lastInput.documentPoint,e=b.x+c.x-d.x;c=b.y+c.y-d.y;a.allowHorizontalScroll||(e=b.x);a.allowVerticalScroll||(c=b.y);a.position=this.Vy.h(e,c)}};
na.Object.defineProperties(xg.prototype,{bubbles:{get:function(){return this.xg},set:function(a){this.xg=a}},originalPosition:{get:function(){return this.Vt}}});xg.className="PanningTool";Na("clickCreatingTool",function(){return this.findTool("ClickCreating")},function(a){this.Za("ClickCreating",a,this.mouseUpTools)});Na("clickSelectingTool",function(){return this.findTool("ClickSelecting")},function(a){this.Za("ClickSelecting",a,this.mouseUpTools)});
Na("panningTool",function(){return this.findTool("Panning")},function(a){this.Za("Panning",a,this.mouseMoveTools)});Na("dragSelectingTool",function(){return this.findTool("DragSelecting")},function(a){this.Za("DragSelecting",a,this.mouseMoveTools)});Na("actionTool",function(){return this.findTool("Action")},function(a){this.Za("Action",a,this.mouseDownTools)});function De(){this.L=this.D=this.j=this.o=null}
na.Object.defineProperties(De.prototype,{mainElement:{get:function(){return this.D},set:function(a){this.D=a}},show:{get:function(){return this.o},set:function(a){this.o!==a&&(this.o=a)}},hide:{get:function(){return this.j},set:function(a){this.j!==a&&(this.j=a)}},valueFunction:{get:function(){return this.L},set:function(a){this.L=a}}});De.className="HTMLInfo";
function yg(a,b,c){this.text=a;this.Cx=b;this.visible=c}yg.className="ContextMenuButtonInfo";function zg(){te.call(this);this.name="ContextMenu";this.o=this.ut=this.j=null;this.Uw=new J;this.vt=null;this.Jt=!1;var a=this;this.mu=function(){a.stopTool()}}ma(zg,te);
function Ag(a){var b=new De;b.show=function(a,b,c){c.showDefaultContextMenu()};b.hide=function(a,b){b.hideDefaultContextMenu()};Bg=b;a.mu=function(){a.stopTool()};b=va("div");var c=va("div");b.style.cssText="top: 0px;z-index:10002;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px";c.style.cssText="z-index:10001;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";
var d=va("style");x.document.getElementsByTagName("head")[0].appendChild(d);d.sheet.insertRule(".goCXul { list-style: none; }",0);d.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }",0);d.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }",0);d=a.diagram;null!==d&&(d.addEventListener(b,"contextmenu",Cg,!1),d.addEventListener(b,"selectstart",
Cg,!1),d.addEventListener(c,"contextmenu",Cg,!1));b.className="goCXforeground";c.className="goCXbackground";x.document.body&&(x.document.body.appendChild(b),x.document.body.appendChild(c));Dg=b;Eg=c;Fg=!0}function Cg(a){a.preventDefault();return!1}
zg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return this.isBeyondDragSize()||!a.lastInput.right||1<a.lastInput.clickCount?!1:a.lastInput.isTouchEvent&&null!==this.defaultTouchContextMenu||null!==this.findObjectWithContextMenu()?!0:!1};zg.prototype.doStart=function(){this.Uw.set(this.diagram.firstInput.documentPoint)};zg.prototype.doStop=function(){this.hideContextMenu();this.currentObject=null};
zg.prototype.findObjectWithContextMenu=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.lastInput,d=null;a instanceof R||(a instanceof Y?d=a:d=b.Zb(c.documentPoint,null,function(a){return!a.layer.isTemporary}));if(null!==d){for(a=d;null!==a;){if(null!==a.contextMenu)return a;a=a.panel}if(b.lastInput.isTouchEvent&&this.defaultTouchContextMenu)return d.part}else if(null!==b.contextMenu)return b;return null};zg.prototype.doActivate=function(){};
zg.prototype.doMouseDown=function(){te.prototype.doMouseDown.call(this);if(this.isActive&&this.currentContextMenu instanceof ye){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doMouseDown(),a.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&Gg(this)};
zg.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof ye){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doCancel(),a.doDeactivate())}Gg(this)};
function Gg(a){var b=a.diagram;if(a.isActive){var c=a.currentContextMenu;if(null!==c){if(!(c instanceof De)){var d=b.Zb(b.lastInput.documentPoint,null,null);null!==d&&d.rg(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.currentTool=a,a.doMouseUp())}}else a.canStart()&&(Hg(a,!0),a.isActive||a.stopTool())}
function Hg(a,b,c){void 0===c&&(c=null);if(!a.Jt&&(a.Jt=!0,b&&a.standardMouseSelect(),b=a.standardMouseClick(),a.Jt=!1,!b)){a.isActive=!0;b=Bg;null===c&&(c=a.findObjectWithContextMenu());if(null!==c){var d=c.contextMenu;null!==d?(a.currentObject=c instanceof Y?c:null,a.showContextMenu(d,a.currentObject)):null!==b&&a.showContextMenu(b,a.currentObject)}else null!==b&&a.showContextMenu(b,null);a.currentContextMenu instanceof ye&&!a.currentContextMenu.visible&&a.stopTool()}}
zg.prototype.doMouseMove=function(){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.doMouseMove();this.isActive&&this.diagram.toolManager.doMouseMove()};
zg.prototype.showContextMenu=function(a,b){var c=this.diagram;a!==this.currentContextMenu&&this.hideContextMenu();if(a instanceof ye){a.layerName="Tool";a.selectable=!1;a.scale=1/c.scale;a.category=this.name;null!==a.placeholder&&(a.placeholder.scale=c.scale);var d=a.diagram;null!==d&&d!==c&&d.remove(a);c.add(a);null!==b?a.adornedObject=b:a.data=c.model;a.Ta();this.positionContextMenu(a,b)}else a instanceof De&&a.show(b,c,this);this.currentContextMenu=a};
zg.prototype.positionContextMenu=function(a){if(null===a.placeholder){var b=this.diagram,c=b.lastInput.documentPoint.copy(),d=a.measuredBounds,e=b.viewportBounds;b.lastInput.isTouchEvent&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5/b.scale);c.x<e.x&&(c.x=e.x);c.y+d.height>e.bottom&&(c.y-=d.height+5/b.scale);c.y<e.y&&(c.y=e.y);a.position=c}};
zg.prototype.hideContextMenu=function(){var a=this.diagram,b=this.currentContextMenu;null!==b&&(b instanceof ye?(a.remove(b),null!==this.ut&&this.ut.Gf(b.category),b.data=null,b.adornedObject=null):b instanceof De&&(null!==b.hide?b.hide(a,this):null!==b.mainElement&&(b.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())};
function Ig(a){var b=new F;b.add(new yg("Copy",function(a){a.commandHandler.copySelection()},function(a){return a.commandHandler.canCopySelection()}));b.add(new yg("Cut",function(a){a.commandHandler.cutSelection()},function(a){return a.commandHandler.canCutSelection()}));b.add(new yg("Delete",function(a){a.commandHandler.deleteSelection()},function(a){return a.commandHandler.canDeleteSelection()}));b.add(new yg("Paste",function(b){b.commandHandler.pasteSelection(a.mouseDownPoint)},function(b){return b.commandHandler.canPasteSelection(a.mouseDownPoint)}));
b.add(new yg("Select All",function(a){a.commandHandler.selectAll()},function(a){return a.commandHandler.canSelectAll()}));b.add(new yg("Undo",function(a){a.commandHandler.undo()},function(a){return a.commandHandler.canUndo()}));b.add(new yg("Redo",function(a){a.commandHandler.redo()},function(a){return a.commandHandler.canRedo()}));b.add(new yg("Scroll To Part",function(a){a.commandHandler.scrollToPart()},function(a){return a.commandHandler.canScrollToPart()}));b.add(new yg("Zoom To Fit",function(a){a.commandHandler.zoomToFit()},
function(a){return a.commandHandler.canZoomToFit()}));b.add(new yg("Reset Zoom",function(a){a.commandHandler.resetZoom()},function(a){return a.commandHandler.canResetZoom()}));b.add(new yg("Group Selection",function(a){a.commandHandler.groupSelection()},function(a){return a.commandHandler.canGroupSelection()}));b.add(new yg("Ungroup Selection",function(a){a.commandHandler.ungroupSelection()},function(a){return a.commandHandler.canUngroupSelection()}));b.add(new yg("Edit Text",function(a){a.commandHandler.editTextBlock()},
function(a){return a.commandHandler.canEditTextBlock()}));return b}
zg.prototype.showDefaultContextMenu=function(){var a=this.diagram;null===this.vt&&(this.vt=Ig(this));Dg.innerHTML="";Eg.addEventListener("pointerdown",this.mu,!1);var b=this,c=va("ul");c.className="goCXul";Dg.appendChild(c);c.innerHTML="";for(var d=this.vt.iterator;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.Cx&&("function"!==typeof f||f(a))){f=va("li");f.className="goCXli";var g=va("a");g.className="goCXa";g.href="#";g.Jy=e.Cx;g.addEventListener("pointerdown",function(c){this.Jy(a);
b.stopTool();c.preventDefault();return!1},!1);g.textContent=e.text;f.appendChild(g);c.appendChild(f)}}Dg.style.display="block";Eg.style.display="block"};zg.prototype.hideDefaultContextMenu=function(){if(null!==this.currentContextMenu&&this.currentContextMenu===Bg){Dg.style.display="none";Eg.style.display="none";var a=this.diagram;null!==a&&a.removeEventListener(Eg,"pointerdown",this.mu,!1);this.currentContextMenu=null}};
na.Object.defineProperties(zg.prototype,{currentContextMenu:{get:function(){return this.j},set:function(a){this.j=a;this.ut=a instanceof ye?a.adornedPart:null}},defaultTouchContextMenu:{get:function(){!1===Fg&&null===Bg&&Jg&&Ag(this);return Bg},set:function(a){null===a&&(Fg=!0);Bg=a}},currentObject:{get:function(){return this.o},set:function(a){this.o=a}},mouseDownPoint:{get:function(){return this.Uw}}});
var Bg=null,Fg=!1,Eg=null,Dg=null;zg.className="ContextMenuTool";Na("contextMenuTool",function(){return this.findTool("ContextMenu")},function(a){this.Za("ContextMenu",a,this.mouseUpTools)});function Kg(){te.call(this);this.name="TextEditing";this.qh=new Lg;this.Ba=null;this.wa=Mg;this.ui=null;this.ia=Ng;this.D=1;this.L=!0;this.o=null;this.j=new De;this.wt=null;Og(this,this.j)}ma(Kg,te);
function Og(a,b){if(Jg){var c=va("textarea");a.wt=c;c.addEventListener("input",function(){if(null!==a.textBlock){var b=a.iy(this.value);this.style.width=20+b.measuredBounds.width*this.SA+"px";this.rows=b.lineCount}},!1);c.addEventListener("keydown",function(b){if(null!==a.textBlock){var c=b.key;"Enter"===c?(!1===a.textBlock.isMultiline&&b.preventDefault(),a.acceptText(Pg)):"Tab"===c?(a.acceptText(Qg),b.preventDefault()):"Escape"===c&&(a.doCancel(),null!==a.diagram&&a.diagram.doFocus())}},!1);c.addEventListener("focus",
function(){if(null!==a.currentTextEditor&&a.state!==Ng){var b=a.wt;a.ia===Rg&&(a.ia=Sg);"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);c.addEventListener("blur",function(){if(null!==a.currentTextEditor&&a.state!==Ng){var b=a.wt;"function"===typeof b.focus&&b.focus();"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);b.valueFunction=function(){return c.value};b.mainElement=c;b.show=function(a,
b,f){if(a instanceof Lg&&f instanceof Kg)if(f.state===Tg)c.style.border="3px solid red",c.focus();else{var d=a.da(xc),e=b.position,k=b.scale,l=a.Af()*k;l<f.minimumEditorScale&&(l=f.minimumEditorScale);var m=a.naturalBounds.width*l+6,n=a.naturalBounds.height*l+2,p=(d.x-e.x)*k;d=(d.y-e.y)*k;e=a.verticalAlignment;k=(a.lineHeight+a.spacingAbove+a.spacingBelow)*a.lineCount*l;n=e.y*n-e.y*k+e.offsetY-(.5*n-.5*k)-k/2;c.value=a.text;b.div.style.font=a.font;c.style.position="absolute";c.style.zIndex="100";
c.style.font="inherit";c.style.fontSize=100*l+"%";c.style.lineHeight="normal";c.style.width=m+"px";c.style.left=(p-m/2|0)-1+"px";c.style.top=(d+n|0)-1+"px";c.style.textAlign=a.textAlign;c.style.margin="0";c.style.padding="1px";c.style.border="0";c.style.outline="none";c.style.whiteSpace="pre-wrap";c.style.overflow="hidden";c.rows=a.lineCount;c.SA=l;c.className="goTXarea";b.div.appendChild(c);c.focus();f.selectsTextOnActivate&&(c.select(),c.setSelectionRange(0,9999))}};b.hide=function(a){a.div.removeChild(c)}}}
Kg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||a.isReadOnly||Ug&&Ug!==this&&(Ug.acceptText(Vg),Ug&&Ug!==this)||!a.lastInput.left||this.isBeyondDragSize())return!1;var b=a.Zb(a.lastInput.documentPoint);if(!(null!==b&&b instanceof Lg&&b.editable&&b.part.canEdit()))return!1;b=b.part;return null===b||this.starting===Mg&&!b.isSelected||this.starting===Wg&&2>a.lastInput.clickCount?!1:!0};Kg.prototype.doStart=function(){Ug=this;null!==this.textBlock&&this.doActivate()};
Kg.prototype.doActivate=function(){if(!this.isActive){var a=this.diagram;if(null!==a){var b=this.textBlock;null===b&&(b=a.Zb(a.lastInput.documentPoint));if(null!==b&&b instanceof Lg&&(this.textBlock=b,null!==b.part)){a.animationManager.qc();this.isActive=!0;this.ia=Rg;var c=this.defaultTextEditor;null!==b.textEditor&&(c=b.textEditor);this.qh=this.textBlock.copy();var d=new M(this.textBlock.da(tc),this.textBlock.da(Bc));a.Fv(d);c.show(b,a,this);this.currentTextEditor=c}}}};Kg.prototype.doCancel=function(){this.stopTool()};
Kg.prototype.doMouseUp=function(){this.canStart()&&this.doActivate()};Kg.prototype.doMouseDown=function(){this.isActive&&this.acceptText(Vg)};Kg.prototype.acceptText=function(a){switch(a){case Vg:if(this.ia===Xg)this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus();else if(this.ia===Rg||this.ia===Tg||this.ia===Sg)this.ia=Yg,Zg(this);break;case $g:case Pg:case Qg:if(Pg!==a||!0!==this.textBlock.isMultiline)if(this.ia===Rg||this.ia===Tg||this.ia===Sg)this.ia=Yg,Zg(this)}};
function Zg(a){var b=a.textBlock,c=a.diagram,d=a.currentTextEditor;if(null!==b&&null!==d){var e=b.text,f="";null!==d.valueFunction&&(f=d.valueFunction());a.isValidText(b,e,f)?(a.xa(a.name),a.ia=Xg,a.transactionResult=a.name,b.text=f,a.doSuccess(e,f),null!==c&&c.S("TextEdited",b,e),a.stopTransaction(),a.stopTool(),null!==c&&c.doFocus()):(a.ia=Tg,a.doError(e,f))}}
Kg.prototype.doError=function(a,b){var c=this.textBlock;null!==c.errorFunction&&c.errorFunction(this,a,b);(a=this.currentTextEditor)&&a.show(c,this.diagram,this)};Kg.prototype.doSuccess=function(a,b){var c=this.textBlock;null!==c.textEdited&&c.textEdited(c,a,b)};Kg.prototype.doDeactivate=function(){var a=this.diagram;null!==a&&(this.ia=Ng,null!==this.currentTextEditor&&this.currentTextEditor.hide(a,this),this.textBlock=null,this.isActive=!1)};Kg.prototype.doStop=function(){Ug=null};
Kg.prototype.isValidText=function(a,b,c){var d=this.textValidation;if(null!==d&&!d(a,b,c))return!1;d=a.textValidation;return null===d||d(a,b,c)?!0:!1};Kg.prototype.iy=function(a){var b=this.qh;b.text=a;b.measure(this.textBlock.ei,Infinity);return b};
na.Object.defineProperties(Kg.prototype,{textBlock:{get:function(){return this.Ba},set:function(a){this.Ba=a}},currentTextEditor:{get:function(){return this.o},set:function(a){this.o=a}},defaultTextEditor:{get:function(){return this.j},set:function(a){this.j=a}},starting:{get:function(){return this.wa},set:function(a){this.wa=a}},textValidation:{get:function(){return this.ui},
set:function(a){this.ui=a}},minimumEditorScale:{get:function(){return this.D},set:function(a){this.D=a}},selectsTextOnActivate:{get:function(){return this.L},set:function(a){this.L=a}},state:{get:function(){return this.ia},set:function(a){this.ia!==a&&(this.ia=a)}}});Kg.prototype.measureTemporaryTextBlock=Kg.prototype.iy;
var $g=new D(Kg,"LostFocus",0),Vg=new D(Kg,"MouseDown",1),Qg=new D(Kg,"Tab",2),Pg=new D(Kg,"Enter",3),ah=new D(Kg,"SingleClick",0),Mg=new D(Kg,"SingleClickSelected",1),Wg=new D(Kg,"DoubleClick",2),Ng=new D(Kg,"StateNone",0),Rg=new D(Kg,"StateActive",1),Sg=new D(Kg,"StateEditing",2),Yg=new D(Kg,"StateValidating",3),Tg=new D(Kg,"StateInvalid",4),Xg=new D(Kg,"StateValidated",5),Ug=null;Kg.className="TextEditingTool";Kg.LostFocus=$g;Kg.MouseDown=Vg;Kg.Tab=Qg;Kg.Enter=Pg;Kg.SingleClick=ah;
Kg.SingleClickSelected=Mg;Kg.DoubleClick=Wg;Kg.StateNone=Ng;Kg.StateActive=Rg;Kg.StateEditing=Sg;Kg.StateValidating=Yg;Kg.StateInvalid=Tg;Kg.StateValidated=Xg;Na("textEditingTool",function(){return this.findTool("TextEditing")},function(a){this.Za("TextEditing",a,this.mouseUpTools)});
function bh(a){ch||(dh(),ch=!0);this.C=ue;this.Xk=this.tb=this.qr=this.kc=!1;this.nx=!0;this.Yk=eh;this.Tm=!1;this.$h=this.wd=!0;this.Kg=600;this.Bw=this.lx=!1;this.Se=new G;this.Sd=new fh;this.Sd.Pd=this;this.aj=new G;this.iu=new G;this.cs=new G;this.yl=new G;a&&Object.assign(this,a)}bh.prototype.Ne=function(a){this.C=a};bh.prototype.canStart=function(){return!0};function gh(a,b){a.wd&&a.canStart(b)&&(a.Se.add(b),a.defaultAnimation.isAnimating&&a.qc(),hh(a.C),a.tb=!0)}
function ih(a){if(a.wd&&a.tb){var b=a.Sd,c=a.C,d=a.Se.contains("Model");d&&(a.Xk=!0,a.Yk===eh?(b.isViewportUnconstrained=!0,b.mc.clear(),b.add(c,"position",c.position.copy().offset(0,-200),c.position),b.add(c,"opacity",0,1)):a.Yk===jh&&b.mc.clear(),a.nx=a.Yk===kh&&c.au.A(c.ja)?!0:!1,c.S("InitialAnimationStarting",a));d&&!a.$h||0===b.mc.count?(a.Se.clear(),a.tb=!1,b.mc.clear(),lh(b,c),a.Xk=!1,c.N()):(a.Se.clear(),c.jg=!1,d=b.mc.get(c),c.autoScale!==mh&&null!==d&&(delete d.start.scale,delete d.end.scale),
x.requestAnimationFrame(function(){!1===a.tb||b.kc||(c.Ie("temporaryPixelRatio")&&Oe(c),nh(c),a.tb=!1,b.start(),Ah(a),c.Qa(),Bh(b,0),uf(c,!0),Ch(a),c.S("AnimationStarting",a))}))}}function Dh(a,b,c,d){a.isTicking||b instanceof T&&(null!==b.fromNode||null!==b.toNode)||a.Sd.add(b,"position",c,d,!1)}t=bh.prototype;t.Ls=function(a){return this.Sd.Ls(a)};t.cv=function(a){return this.Sd.cv(a)};
function Eh(a,b){function c(){0<e.cs.count&&(d.addAll(e.cs),e.cs.clear(),e.kc=!0);if(!1!==e.kc&&0!==d.count){e.iu.addAll(d);for(var a=e.iu.iterator;a.next();){var b=a.value;if(!1!==b.kc){a:if(0<b.Pl.count)var h=!0;else{for(h=b.mc.iterator;h.next();){var k=h.key;if(k instanceof Y&&null!==k.diagram||k instanceof R){h=!0;break a}}h=!1}h?Fh(b,!1):b.el=!0}}e.iu.clear();Ah(e);uf(e.C);Ch(e);x.requestAnimationFrame(c)}}var d=a.aj,e=a;a.kc?a.cs.add(b):(a.kc=!0,d.add(b),x.requestAnimationFrame(function(){c()}))}
function Gh(a){for(a=a.aj.iterator;a.next();)a.value.el=!1}function Ah(a){if(!a.qr){var b=a.C;a.lx=b.skipsUndoManager;a.Bw=b.skipsModelSourceBindings;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;a.qr=!0}}function Ch(a){var b=a.C;b.skipsUndoManager=a.lx;b.skipsModelSourceBindings=a.Bw;a.qr=!1}
t.qc=function(a){var b=this.Sd;!0===this.tb&&(this.Xk=this.tb=!1,this.Se.clear(),0<b.mc.count&&this.C.Fb());if(this.kc){if(b.Xl(!0),b.mc.clear(),lh(b,null),!0===a)for(a=this.aj.ya(),b=0;b<a.length;b++)a[b].Xl(!0)}else b.mc.clear(),lh(b,this.C)};t.Xl=function(a){a===this.defaultAnimation&&this.defaultAnimation.mc.clear();this.aj.remove(a);0===this.aj.count&&(this.kc=!1,this.C.Fb());a===this.defaultAnimation&&(this.defaultAnimation.mc.clear(),this.C.S("AnimationFinished",this))};
t.Mj=function(a,b){this.tb&&(this.Se.contains("Expand Tree")||this.Se.contains("Expand SubGraph"))&&(this.Sd.Mj(a,b),Hh(this,a))};t.Kj=function(a,b){this.tb&&(this.Se.contains("Collapse Tree")||this.Se.contains("Collapse SubGraph"))&&(this.Sd.Kj(a,b),Ih(this.Sd,b,"position",b.position,b.position),Hh(this,a))};function Jh(a,b,c){a.tb&&!b.A(c)&&(a.C.Oi||(b=c.copy()),Ih(a.Sd,a.C,"position",b,c))}
function Hh(a,b){for(b=b.findLinksConnected();b.next();){var c=b.value;c.gf=c.points.copy();a.yl.add(c)}}function Kh(a,b,c,d,e){null===a&&(a=[0,0,0,0]);null===b&&(b=[0,0,0,0]);var f=a[0],g=a[1],h=a[2];a=a[3];var k=b[0],l=b[1],m=b[2];b=b[3];if(0===h||100===h)f=k,g=l;else if(0===m||100===m)k=f,l=g;180<Math.abs(k-f)&&(k>f?f+=360:k+=360);f=e(c,f,k-f,d)%360;g=e(c,g,l-g,d);h=e(c,h,m-h,d);c=e(c,a,b-a,d);return"hsla("+f+", "+g+"%, "+h+"%, "+c+")"}
function dh(){function a(a,b,e,f,g,h){a.position=new J(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))}var b=new I;b.add("position:diagram",a);b.add("position",a);b.add("position:part",function(a,b,e,f,g,h){g<h?a.wm(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h),!1):a.position=new J(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))});b.add("location",function(a,b,e,f,g,h){g<h?a.wm(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h),!0):a.location=new J(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))});b.add("position:placeholder",function(a,b,e,f,
g,h){g<h?a.wm(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h),!1):a.position=new J(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))});b.add("position:nodeCollapse",function(a,b,e,f,g,h){var c=a.actualBounds,d=e.actualBounds;e=d.x+d.width/2-c.width/2;c=d.y+d.height/2-c.height/2;g<h?a.wm(f(g,b.x,e-b.x,h),f(g,b.y,c-b.y,h),!1):a.position=new J(f(g,b.x,e-b.x,h),f(g,b.y,c-b.y,h))});b.add("desiredSize",function(a,b,e,f,g,h){a.desiredSize=new M(f(g,b.width,e.width-b.width,h),f(g,b.height,e.height-b.height,h))});b.add("width",
function(a,b,e,f,g,h){a.width=f(g,b,e-b,h)});b.add("height",function(a,b,e,f,g,h){a.height=f(g,b,e-b,h)});b.add("fill",function(a,b,e,f,g,h){a.fill=Kh(b,e,g,h,f)});b.add("stroke",function(a,b,e,f,g,h){a.stroke=Kh(b,e,g,h,f)});b.add("strokeWidth",function(a,b,e,f,g,h){a.strokeWidth=f(g,b,e-b,h)});b.add("strokeDashOffset",function(a,b,e,f,g,h){a.strokeDashOffset=f(g,b,e-b,h)});b.add("background",function(a,b,e,f,g,h){a.background=Kh(b,e,g,h,f)});b.add("areaBackground",function(a,b,e,f,g,h){a.areaBackground=
Kh(b,e,g,h,f)});b.add("opacity",function(a,b,e,f,g,h){a.opacity=f(g,b,e-b,h)});b.add("scale",function(a,b,e,f,g,h){a.scale=f(g,b,e-b,h)});b.add("angle",function(a,b,e,f,g,h){a.angle=f(g,b,e-b,h)});Lh=b}
na.Object.defineProperties(bh.prototype,{animationReasons:{get:function(){return this.Se}},isEnabled:{get:function(){return this.wd},set:function(a){(this.wd=a)&&this.aj.each(function(a){a.isAnimating||Infinity!==a.runCount||a.start()})}},duration:{get:function(){return this.Kg},set:function(a){1>a&&xa(a,">= 1",bh,"duration");this.Kg=a}},isAnimating:{get:function(){return this.kc}},
isTicking:{get:function(){return this.qr}},isInitial:{get:function(){return this.$h},set:function(a){this.$h=a}},defaultAnimation:{get:function(){return this.Sd}},activeAnimations:{get:function(){return this.aj}},initialAnimationStyle:{get:function(){return this.Yk},set:function(a){this.Yk=a}}});bh.prototype.stopAnimation=bh.prototype.qc;
var Lh=null,ch=!1,eh=new D(bh,"Default",1),kh=new D(bh,"AnimateLocations",2),jh=new D(bh,"None",3);bh.className="AnimationManager";bh.defineAnimationEffect=function(a,b){ch||(dh(),ch=!0);Lh.add(a,b)};bh.Default=eh;bh.AnimateLocations=kh;bh.None=jh;
function fh(a){this.nu=this.kx=this.Pd=this.C=null;this.el=this.kc=this.j=!1;this.xn=this.Cd=0;this.Oq=this.At=Mh;this.dl=this.Xo=!1;this.$t=1;this.Yt=0;this.vd=this.Kg=NaN;this.Fw=0;this.yn=null;this.o=qb;this.mc=new I;this.Tt=new I;this.Pl=new G;this.Ut=new G;this.Cw=Nh;a&&Object.assign(this,a)}fh.prototype.suspend=function(){this.el=!0};fh.prototype.advanceTo=function(a,b){b&&(this.el=!1);this.Xo&&a>=this.vd&&(this.dl=!0,a-=this.vd);this.Fw=a;Fh(this,!0);Ah(this.Pd);uf(this.C);Ch(this.Pd);this.C.redraw()};
function lh(a,b){a.Tt.clear();a.dl=!1;a.Yt=0;a.vd=NaN;0<a.Pl.count&&a.Pl.clear();0<a.Ut.count&&a.Ut.clear();if(null!==b)for(a=b.links;a.next();)a.value.gf=null}t=fh.prototype;
t.start=function(){if(0===this.mc.count||this.kc)return this;for(var a=this.C,b=this.mc.iterator;b.next();){var c=b.value.end,d=b.key;if(c["position:placeholder"]){var e=d.findVisibleNode();if(e instanceof U&&null!==e.placeholder){var f=e.placeholder;e=f.da(tc);f=f.padding;e.x+=f.left;e.y+=f.top;c["position:placeholder"]=e}}null===a&&(d instanceof R?a=d:d instanceof Y&&(a=d.diagram))}if(null!==a)this.C=a,this.Pd=a.animationManager;else return this;b=this.Pd;if(!1===b.isEnabled)return this;this.vd=
isNaN(this.Kg)?b.duration:this.Kg;this.Oq=this.At;b.Xk&&b.Yk===eh&&this===b.defaultAnimation&&(this.Oq=Oh,this.vd=isNaN(this.Kg)?600===b.duration?900:b.duration:this.Kg);this.Cw=a.scrollMode;this.isViewportUnconstrained&&(a.Gj=Ph);Ah(b);this.Pl.each(function(b){b.data=null;a.add(b)});Ch(b);this.kc=!0;this.Cd=+new Date;this.xn=this.Cd+this.vd;Eh(b,this);return this};t.dz=function(a,b){if(!a.Nc())return this;this.Pl.add(a);this.C=b;return this};
t.add=function(a,b,c,d,e){if("position"===b&&c.A(d))return this;null===this.C&&(a instanceof R?this.C=a:a instanceof Y&&null!==a.diagram&&(this.C=a.diagram));if(a instanceof V){if(!a.isAnimated)return this;"position"===b&&(b="position:part")}Ih(this,a,b,c,d,e);return this};
function Ih(a,b,c,d,e,f){var g=a.mc;b instanceof R&&"position"===c&&(c="position:diagram");if("fill"===c||"stroke"===c||"background"===c||"areaBackground"===c)Qh(d),Rh(),d=[Sh.j,Sh.D,Sh.o,Sh.L],Qh(e),Rh(),e=[Sh.j,Sh.D,Sh.o,Sh.L];if(g.contains(b)){var h=g.H(b);var k=h.start;var l=h.end;void 0===k[c]&&(k[c]=Th(d));l[c]=Th(e)}else k={},l={},k[c]=Th(d),l[c]=Th(e),h=k.position,b instanceof Y&&h instanceof J&&!h.u()&&b.diagram.animationManager.Se.contains("Expand SubGraph")&&h.assign(l.position),h=new Uh(k,
l,f),g.add(b,h);g=k[c];g instanceof J&&!g.u()&&g.assign(a.o);f&&0===c.indexOf("position:")&&b instanceof V?h.Lu.location=Th(b.location):f&&(h.Lu[c]=Th(d))}function Th(a){return a instanceof J?a.copy():a instanceof Fb?a.copy():a}t.Ls=function(a){if(!this.kc)return!1;a=this.mc.H(a);return null!==a&&a.yv};t.cv=function(a){if(!this.kc)return!1;a=this.mc.H(a);return null!==a&&(a.start.position||a.start.location)};
function Fh(a,b){if(!a.el||b){var c=a.Pd;if(!1!==a.kc){var d=+new Date,e=d>a.xn?a.vd:d-a.Cd;b&&(e=a.Fw,e<a.vd?(a.Cd=+new Date-e,a.xn=a.Cd+a.vd):e=a.vd);Ah(c);Bh(a,e);uf(a.C,!0);Ch(c);d>a.xn&&(a.Xo&&!a.dl?(a.Cd=+new Date,a.xn=a.Cd+a.vd,a.dl=!0):a.Xl(!1))}}}
function Bh(a,b){for(var c=a.vd,d=a.mc.iterator,e=a.dl;d.next();){var f=d.key;if(!(f instanceof Y&&null===f.diagram)){var g=d.value,h=e?g.end:g.start;g=e?g.start:g.end;var k=Lh,l;for(l in g)"position"===l&&(g["position:placeholder"]||g["position:nodeCollapse"])||null===k.get(l)||k.get(l)(f,h[l],g[l],a.Oq,b,c,a)}}}t.stop=function(){if(!this.kc)return this;this.Xl(!0);return this};
t.Xl=function(a){null!==this.nu&&this.nu.ep.remove(this.kx);if(this.kc){var b=this.C,c=this.Pd;this.el=this.kc=c.Xk=!1;Ah(c);for(var d=this.mc,e=this.Pl.iterator;e.next();)b.remove(e.value);for(e=this.Ut.iterator;e.next();)e.value.s();e=this.Xo;d=d.iterator;for(var f=Lh;d.next();){var g=d.key,h=d.value,k=e?h.end:h.start,l=e?h.start:h.end,m=h.Lu,n;for(n in l)if(null!==f.get(n)){var p=n;!h.Du||"position:nodeCollapse"!==p&&"position:placeholder"!==p||(p="position");f.get(p)(g,k[n],void 0!==m[n]?m[n]:
h.Du?k[n]:l[n],this.Oq,this.vd,this.vd,this)}h.Du&&void 0!==m.location&&g instanceof V&&(g.location=m.location);h.yv&&g instanceof V&&g.Ob(!1)}b.Gs.clear();Ye(b,!1);b.Qa();b.N();uf(b,!0);if(c.defaultAnimation===this){for(n=c.yl.iterator;n.next();)e=n.value,null!==e.gf&&(e.points=e.gf,e.gf=null);c.yl.clear()}this.isViewportUnconstrained&&(b.scrollMode=this.Cw);Ch(c);this.Yt++;!a&&this.$t>this.Yt?(this.dl=!1,this.start()):(this.yn&&this.yn(this),lh(this,null),c.Xl(this),b.Fb())}};
t.Mj=function(a,b){var c=b.actualBounds,d=null;b instanceof U&&(d=b.placeholder);null!==d?(c=d.da(tc),d=d.padding,c.x+=d.left,c.y+=d.top,this.add(a,"position",c,a.position,!1)):this.add(a,"position",new J(c.x+c.width/2,c.y+c.height/2),a.position,!1);this.add(a,"scale",.01,a.scale,!1);if(a instanceof U)for(a=a.memberParts;a.next();)d=a.value,d instanceof W&&this.Mj(d,b)};
t.Kj=function(a,b){if(a.isVisible()){var c=null;b instanceof U&&(c=b.placeholder);null!==c?this.add(a,"position:placeholder",a.position,c,!0):this.add(a,"position:nodeCollapse",a.position,b,!0);this.add(a,"scale",a.scale,.01,!0);c=this.mc;c.contains(a)&&(c.H(a).yv=!0);if(a instanceof U)for(a=a.memberParts;a.next();)c=a.value,c instanceof W&&this.Kj(c,b)}};t.bA=function(a){var b=this.Tt.get(a);null===b&&(b={},this.Tt.add(a,b));return b};
na.Object.defineProperties(fh.prototype,{duration:{get:function(){return this.Kg},set:function(a){1>a&&xa(a,">= 1",fh,"duration");this.Kg=a}},reversible:{get:function(){return this.Xo},set:function(a){this.Xo=a}},runCount:{get:function(){return this.$t},set:function(a){0<a?this.$t=a:C("Animation.runCount value must be a positive integer.")}},finished:{get:function(){return this.yn},
set:function(a){this.yn!==a&&(this.yn=a)}},easing:{get:function(){return this.At},set:function(a){this.At=a}},isViewportUnconstrained:{get:function(){return this.j},set:function(a){this.j=a}},isAnimating:{get:function(){return this.kc}}});fh.prototype.getTemporaryState=fh.prototype.bA;fh.prototype.stop=fh.prototype.stop;fh.prototype.add=fh.prototype.add;fh.prototype.addTemporaryPart=fh.prototype.dz;
function Mh(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}function Oh(a,b,c,d){return a===d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b}fh.className="Animation";fh.EaseLinear=function(a,b,c,d){return c*a/d+b};fh.EaseInOutQuad=Mh;fh.EaseInQuad=function(a,b,c,d){return c*(a/=d)*a+b};fh.EaseOutQuad=function(a,b,c,d){return-c*(a/=d)*(a-2)+b};fh.EaseInExpo=function(a,b,c,d){return 0===a?b:c*Math.pow(2,10*(a/d-1))+b};fh.EaseOutExpo=Oh;
function Uh(a,b,c){this.start=a;this.end=b;this.Lu={};this.Du=c;this.yv=!1}Uh.className="AnimationState";function Vh(a,b,c){this.pd=null;this.ff=a;this.vp=c||Wh;this.yk=null;void 0!==b&&(this.yk=b,void 0===c&&(this.vp=Xh))}Vh.prototype.copy=function(){var a=new Vh(this.ff);a.vp=this.vp;var b=this.yk;if(null!==b){var c={};void 0!==b.duration&&(c.duration=b.duration);void 0!==b.finished&&(c.finished=b.finished);void 0!==b.easing&&(c.easing=b.easing);a.yk=c}return a};
function Yh(a,b){a=a.yk;null!==a&&(a.duration&&(b.duration=a.duration),a.finished&&(b.finished=a.finished),a.easing&&(b.easing=a.easing))}na.Object.defineProperties(Vh.prototype,{propertyName:{get:function(){return this.ff},set:function(a){this.ff=a}},animationSettings:{get:function(){return this.yk},set:function(a){this.yk=a}},startCondition:{get:function(){return this.vp},set:function(a){this.vp=a}}});
var Wh=new D(Vh,"Default",1),Xh=new D(Vh,"Immediate",2),Zh=new D(Vh,"Bundled",3);Vh.className="AnimationTrigger";Vh.Default=Wh;Vh.Immediate=Xh;Vh.Bundled=Zh;function $h(a){Ua(this);this.C=null;this.Ha=new F;this.na="";this.mb=1;this.o=!1;this.j=this.oi=this.Cc=this.Nd=this.rc=this.Rb=this.Gb=this.Ma=this.Qb=this.Ba=this.ke=this.wa=this.Od=this.L=this.D=!0;this.Jo=[];a&&Object.assign(this,a)}t=$h.prototype;t.clear=function(){this.Ha.clear();this.Jo.length=0};t.Ne=function(a){this.C=a};
t.toString=function(a){void 0===a&&(a=0);var b='Layer "'+this.name+'"';if(0>=a)return b;for(var c=0,d=0,e=0,f=0,g=0,h=this.Ha.iterator;h.next();){var k=h.value;k instanceof U?e++:k instanceof W?d++:k instanceof T?f++:k instanceof ye?g++:c++}h="";0<c&&(h+=c+" Parts ");0<d&&(h+=d+" Nodes ");0<e&&(h+=e+" Groups ");0<f&&(h+=f+" Links ");0<g&&(h+=g+" Adornments ");if(1<a)for(a=this.Ha.iterator;a.next();)c=a.value,h+="\n    "+c.toString(),d=c.data,null!==d&&fb(d)&&(h+=" #"+fb(d)),c instanceof W?h+=" "+
La(d):c instanceof T&&(h+=" "+La(c.fromNode)+" "+La(c.toNode));return b+" "+this.Ha.count+": "+h};t.Zb=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.oi)return null;var d=!1;null!==this.diagram&&this.diagram.viewportBounds.$(a)&&(d=!0);for(var e=J.alloc(),f=this.Ha.m,g=f.length;g--;){var h=f[g];if((!0!==d||!1!==lg(h))&&h.isVisible()&&(e.assign(a),yb(e,h.fe),h=h.Zb(e,b,c),null!==h&&(null!==b&&(h=b(h)),null!==h&&(null===c||c(h)))))return J.free(e),h}J.free(e);return null};
t.Hi=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof F||d instanceof G||(d=new G);if(!1===this.oi)return d;var e=!1;null!==this.diagram&&this.diagram.viewportBounds.$(a)&&(e=!0);for(var f=J.alloc(),g=this.Ha.m,h=g.length;h--;){var k=g[h];if((!0!==e||!1!==lg(k))&&k.isVisible()){f.assign(a);yb(f,k.fe);var l=k;k.Hi(f,b,c,d)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||d.add(l))}}J.free(f);return d};
t.zf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof F||e instanceof G||(e=new G);if(!1===this.oi)return e;var f=!1;null!==this.diagram&&this.diagram.viewportBounds.Ge(a)&&(f=!0);for(var g=this.Ha.m,h=g.length;h--;){var k=g[h];if((!0!==f||!1!==lg(k))&&k.isVisible()){var l=k;k.zf(a,b,c,d,e)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||e.add(l))}}return e};
t.Qu=function(a,b,c,d,e,f,g){if(!1===this.oi)return e;for(var h=this.Ha.m,k=h.length;k--;){var l=h[k];if((!0!==g||!1!==lg(l))&&f(l)&&l.isVisible()){var m=l;l.zf(a,b,c,d,e)&&(null!==b&&(m=b(m)),null===m||null!==c&&!c(m)||e.add(m))}}return e};
t.pg=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof F||e instanceof G)f=e;e=!0}f instanceof F||f instanceof G||(f=new G);if(!1===this.oi)return f;var g=!1;null!==this.diagram&&this.diagram.viewportBounds.$(a)&&(g=!0);for(var h=J.alloc(),k=J.alloc(),l=this.Ha.m,m=l.length;m--;){var n=l[m];if((!0!==g||!1!==lg(n))&&n.isVisible()){h.assign(a);yb(h,n.fe);k.h(a.x+b,a.y);yb(k,n.fe);var p=n;n.pg(h,k,c,d,e,f)&&(null!==c&&(p=c(p)),null===
p||null!==d&&!d(p)||f.add(p))}}J.free(h);J.free(k);return f};
t.Md=function(a,b){if(this.visible){var c=this.Ha.m,d=c.length;if(0!==d){a=Ga();for(var e=Ga(),f=0;f<d;f++){var g=c[f];g.Sw=f;if(g instanceof T){if(!1===g.ud)continue}else if(g instanceof ye&&null!==g.adornedPart)continue;var h=g.actualBounds;g.isVisible()&&Zb(h,b)?(g.Md(!0),a.push(g)):(g.Md(!1),null!==g.adornments&&0<g.adornments.count&&e.push(g))}for(b=0;b<a.length;b++)for(c=a[b],ai(c),c=c.adornments;c.next();)d=c.value,d.measure(Infinity,Infinity),d.arrange(),d.Md(!0);for(b=0;b<e.length;b++)ai(e[b]);
Ja(a);Ja(e)}}};function bi(a,b){var c=1;1!==a.mb&&(c=b.globalAlpha,b.globalAlpha=c*a.mb);return c}t.oc=function(a,b,c){if(this.visible&&0!==this.mb&&(void 0===c&&(c=!0),c||!this.isTemporary)){c=this.Ha.m;var d=c.length;if(0!==d){var e=bi(this,a),f=this.Jo;f.length=0;for(var g=b.scale,h=M.alloc(),k=0;k<d;k++)this.Di(a,c[k],b,f,g,h,!0);M.free(h);a.globalAlpha=e}}};
t.Di=function(a,b,c,d,e,f,g){if(!g||lg(b)){if(null!==d&&b instanceof T&&(b.isOrthogonal&&d.push(b),!1===b.ud))return;g=!1;for(d=b.containingGroup;null!==d;)g?null!==d.$a&&f.Zx(d.$a):null!==d.$a&&(g=!0,f.assign(d.$a)),d=d.containingGroup;var h=b.actualBounds;d=!1;if(g&&b.isVisible()){if(!f.Mc(h))return;d=!f.Ge(h)}d&&(a.save(),a.beginPath(),a.rect(f.x,f.y,f.width,f.height),a.clip());h.width*e>c.wr||h.height*e>c.wr?b.oc(a,c):(e=b.actualBounds,f=b.naturalBounds,0===e.width||0===e.height||isNaN(e.x)||
isNaN(e.y)||!b.isVisible()||(c=b.transform,null!==b.areaBackground&&(ci(b,a,b.areaBackground,!0,!0,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null===b.areaBackground&&null===b.background&&(ci(b,a,"rgba(0,0,0,0.3)",!0,!1,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null!==b.background&&(a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),ci(b,a,b.background,!0,!1,f,e),a.fillRect(0,0,f.width/2,f.height/2),c.Bs()||(b=1/(c.m11*c.m22-c.m12*c.m21),a.transform(c.m22*b,-c.m12*b,-c.m21*b,c.m11*b,b*(c.m21*c.dy-c.m22*
c.dx),b*(c.m12*c.dx-c.m11*c.dy))))));d&&(a.restore(),a.Ic(!0))}};t.g=function(a,b,c,d,e){var f=this.diagram;null!==f&&f.Wa(ge,a,this,b,c,d,e)};t.Ni=function(a,b,c){var d=this.Ha;b.fi=this;if(a>=d.count)a=d.count;else if(d.J(a)===b)return-1;d.wb(a,b);b.bq(c);d=this.diagram;null!==d&&(c?d.N():d.Ni(b));di(this,a,b);return a};
t.ec=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.ec(a,b,c);var d=this.Ha;if(0>a||a>=d.length){if(a=d.indexOf(b),0>a)return-1}else if(d.J(a)!==b&&(a=d.indexOf(b),0>a))return-1;b.cq(c);d.eb(a);d=this.diagram;null!==d&&(c?d.N():d.ec(b));b.fi=null;return a};
function di(a,b,c){b=ei(a,b,c);if(c instanceof U&&null!==c&&isNaN(c.zOrder)){if(0!==c.memberParts.count){for(var d=-1,e=a.Ha.m,f=e.length,g=0;g<f;g++){var h=e[g];if(h===c&&(b=g,0<=d))break;if(0>d&&h.containingGroup===c&&(d=g,0<=b))break}!(0>d)&&d<b&&(e=a.Ha,e.eb(b),e.wb(d,c))}c=c.containingGroup;null!==c&&di(a,-1,c)}}
function ei(a,b,c){var d=c.zOrder;if(isNaN(d))return b;a=a.Ha;var e=a.count;if(1>=e)return b;0>b&&(b=a.indexOf(c));if(0>b)return-1;for(var f=b-1,g=NaN;0<=f;){g=a.J(f).zOrder;if(!isNaN(g))break;f--}for(var h=b+1,k=NaN;h<e;){k=a.J(h).zOrder;if(!isNaN(k))break;h++}if(!isNaN(g)&&g>d)for(;;){if(-1===f||g<=d){f++;if(f===b)break;a.eb(b);a.wb(f,c);return f}for(g=NaN;0<=--f&&(g=a.J(f).zOrder,isNaN(g)););}else if(!isNaN(k)&&k<d)for(;;){if(h===e||k>=d){h--;if(h===b)break;a.eb(b);a.wb(h,c);return h}for(k=NaN;++h<
e&&(k=a.J(h).zOrder,isNaN(k)););}return b}
na.Object.defineProperties($h.prototype,{parts:{get:function(){return this.Ha.iterator}},partsBackwards:{get:function(){return this.Ha.iteratorBackwards}},diagram:{get:function(){return this.C}},name:{get:function(){return this.na},set:function(a){var b=this.na;if(b!==a){var c=this.diagram;if(null!==c)for(""===b&&C("Cannot rename default Layer to: "+a),c=c.layers;c.next();)c.value.name===
a&&C("Layer.name is already present in this diagram: "+a);this.na=a;this.g("name",b,a);for(a=this.Ha.iterator;a.next();)a.value.layerName=this.na}}},opacity:{get:function(){return this.mb},set:function(a){var b=this.mb;b!==a&&((0>a||1<a)&&xa(a,"0 <= value <= 1",$h,"opacity"),this.mb=a,this.g("opacity",b,a),a=this.diagram,null!==a&&a.N())}},isTemporary:{get:function(){return this.o},set:function(a){var b=this.o;if(b!==a){if(this.o=a)this.isInDocumentBounds=
!1;this.g("isTemporary",b,a)}}},visible:{get:function(){return this.Cc},set:function(a){var b=this.Cc;if(b!==a){this.Cc=a;this.g("visible",b,a);for(b=this.Ha.iterator;b.next();)b.value.Ob(a);a=this.diagram;null!==a&&a.N()}}},pickable:{get:function(){return this.oi},set:function(a){var b=this.oi;b!==a&&(this.oi=a,this.g("pickable",b,a))}},isInDocumentBounds:{get:function(){return this.j},set:function(a){this.j!==
a&&(this.j=a,null!==this.diagram&&this.diagram.Qa())}},allowCopy:{get:function(){return this.D},set:function(a){var b=this.D;b!==a&&(this.D=a,this.g("allowCopy",b,a))}},allowDelete:{get:function(){return this.L},set:function(a){var b=this.L;b!==a&&(this.L=a,this.g("allowDelete",b,a))}},allowTextEdit:{get:function(){return this.Od},set:function(a){var b=this.Od;b!==a&&(this.Od=a,this.g("allowTextEdit",b,a))}},
allowGroup:{get:function(){return this.wa},set:function(a){var b=this.wa;b!==a&&(this.wa=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.ke},set:function(a){var b=this.ke;b!==a&&(this.ke=a,this.g("allowUngroup",b,a))}},allowLink:{get:function(){return this.Ba},set:function(a){var b=this.Ba;b!==a&&(this.Ba=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.Qb},
set:function(a){var b=this.Qb;b!==a&&(this.Qb=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.Ma},set:function(a){var b=this.Ma;b!==a&&(this.Ma=a,this.g("allowMove",b,a))}},allowReshape:{get:function(){return this.Gb},set:function(a){var b=this.Gb;b!==a&&(this.Gb=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.Rb},set:function(a){var b=this.Rb;b!==a&&(this.Rb=a,this.g("allowResize",
b,a))}},allowRotate:{get:function(){return this.rc},set:function(a){var b=this.rc;b!==a&&(this.rc=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.Nd},set:function(a){var b=this.Nd;b!==a&&(this.Nd=a,this.g("allowSelect",b,a))}}});$h.prototype.findObjectsNear=$h.prototype.pg;$h.prototype.findObjectsIn=$h.prototype.zf;$h.prototype.findObjectsAt=$h.prototype.Hi;$h.prototype.findObjectAt=$h.prototype.Zb;$h.className="Layer";
function R(a,b){fi||(gi(),fi=!0);Ua(this);ue=this;this.qb=!0;this.Ga=null;this.ta=this.ua=0;this.Ca=null;if(Jg){var c=this,d=function(){c.removeEventListener(x.document,"DOMContentLoaded",d,!1);c.setRTL()};null!==x.document.body?this.setRTL():c.addEventListener(x.document,"DOMContentLoaded",d,!1)}this.xl=null;hi.add("Model",ii);var e=this;this.mw=function(a){var b=e.partManager;if(a.model===b.diagram.model&&b.diagram.Z){b.diagram.Z=!1;try{var c=a.change;""===a.modelChange&&c===ge&&b.updateDataBindings(a.object,
a.propertyName)}finally{b.diagram.Z=!0}}};this.nw=function(a){e.partManager.doModelChanged(a)};this.du=this.fu=null;ji(this);this.model=ki();this.kh=!0;li(this);this.layout=new mi;this.kh=!1;this.lk=this.mk=this.kk=this.jk=this.xA=this.gk=this.Zv=null;this.nq=function(){};this.preventDefault=null;this.Tn=!1;this.Zh=new ni;void 0!==a&&("string"===typeof a||x.Element&&a instanceof Element?oi(this,a):b=a);this.qb=!1;b&&this.xm(b);return this}var pi,ue;
function ji(a){a.Pd=new bh;a.Pd.Ne(a);a.ub=17;a.bx=!1;a.Vn=!1;a.Zt="default";a.Oa=new F;a.Qy=new I;a.sy();a.qy();a.mb=1;a.ja=(new J(NaN,NaN)).freeze();a.au=new J(NaN,NaN);a.sa=1;a.Rq=1;a.Zu=(new J(NaN,NaN)).freeze();a.fv=NaN;a.sv=1E-4;a.ov=100;a.vb=new nd;a.et=(new J(NaN,NaN)).freeze();a.Fu=(new M(NaN,NaN,NaN,NaN)).freeze();a.Fj=(new kc(0,0,0,0)).freeze();a.Gj=Nh;a.at=!1;a.cw=null;a.dw=null;a.Ph=mh;a.Gk=Tc;a.Qg=mh;a.hr=Tc;a.Xu=tc;a.gv=tc;a.Wc=!0;a.Qn=!1;a.te=new G;a.Xh=new I;a.qn=!0;a.Bq=250;a.zk=
-1;a.Dq=(new kc(16,16,16,16)).freeze();a.jg=!1;a.Qk=!1;a.zn=!0;a.br=new ce;a.br.diagram=a;a.gh=new ce;a.gh.diagram=a;a.rj=new ce;a.rj.diagram=a;a.zg=null;a.df=null;a.ju=!1;qi(a);a.wi=new G;a.hv=!0;a.bt=ri;a.jw=!1;a.dt=zf;a.Ys="auto";a.Zi="auto";a.Ag=null;a.Ig=null;a.Cg=null;a.ah=null;a.Zg=null;a.Yg=null;a.vv=null;a.Wg=null;a.Su=!1;a.Xg=null;a.$g=null;a.uh=null;a.Dg=null;a.St=!1;a.Wt={};a.ul=[null,null];a.kh=!1;a.pw=!1;a.hu=!1;a.xt=!1;a.lw=!0;a.Xc=!1;a.nj=!1;a.px=!0;a.se=-2;a.eh=new I;a.Oo=new F;a.Rg=
!1;a.wd=!0;a.rk=!0;a.D=!0;a.L=!0;a.sk=!1;a.Im=!0;a.Od=!0;a.wa=!0;a.ke=!0;a.jt=!0;a.Ba=!0;a.Qb=!0;a.Ma=!0;a.Gb=!0;a.Rb=!0;a.rc=!0;a.Nd=!0;a.kt=!0;a.nt=!0;a.kw=!1;a.cl=!1;a.Mn=!0;a.Nn=!0;a.it=!0;a.mt=!0;a.Zs=16;a.$s=16;a.Nr=!1;a.cu=!1;a.gu=0;a.eu=0;a.nb=(new kc(5)).freeze();a.ex=(new G).freeze();a.rv=999999999;a.Nw=(new G).freeze();a.jj=!0;a.kj=!0;a.lj=!0;a.Ye=!1;a.Sf=!1;a.Oh=!0;a.Uf=!1;a.Gy=new G;a.Ow=new G;a.$c=null;a.Xw=1;a.gx=0;a.ed={scale:1,position:new J,bounds:new M,zx:new Fb,jy:new Fb,by:!1};
a.ox=(new M(NaN,NaN,NaN,NaN)).freeze();a.Fp=(new Fb(NaN,NaN)).freeze();a.Tq=(new M(NaN,NaN,NaN,NaN)).freeze();a.iv=!1;a.j=new I;var b=new W,c=new Lg;c.bind(new si("text","",La));b.add(c);a.My=b;a.j.add("",b);b=new W;c=new Lg;c.stroke="brown";c.bind(new si("text","",La));b.add(c);a.j.add("Comment",b);b=new W;b.selectable=!1;b.avoidable=!1;c=new xf;c.figure="Ellipse";c.fill="black";c.stroke=null;c.desiredSize=(new Fb(3,3)).ca();b.add(c);a.j.add("LinkLabel",b);a.Cc=new I;b=new U;b.selectionObjectName=
"GROUPPANEL";b.type=X.Vertical;c=new Lg;c.font="bold 12pt sans-serif";c.bind(new si("text","",La));b.add(c);c=new X(X.Auto);c.name="GROUPPANEL";var d=new xf;d.figure="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new mg;d.padding=(new kc(5,5,5,5)).ca();c.add(d);b.add(c);a.Ky=b;a.Cc.add("",b);a.o=new I;b=new T;c=new xf;c.isPanelMain=!0;b.add(c);c=new xf;c.toArrow="Standard";c.fill="black";c.stroke=null;c.strokeWidth=0;b.add(c);a.Ly=b;a.o.add("",b);b=new T;c=new xf;c.isPanelMain=
!0;c.stroke="brown";b.add(c);a.o.add("Comment",b);b=new ye;b.type=X.Auto;c=new xf;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);c=new mg;c.margin=(new kc(1.5,1.5,1.5,1.5)).ca();b.add(c);a.Dv=b;a.Ku=b;b=new ye;b.type=X.Link;c=new xf;c.isPanelMain=!0;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);a.mv=b;a.Yd=null;a.fr=!1;a.Jk=null;a.partManager=new ii;a.toolManager=new Pa;a.toolManager.initializeStandardTools();a.defaultTool=a.toolManager;a.currentTool=a.defaultTool;a.ru=null;
a.on=new Le;a.Sv=null;a.Yv=null;a.Yr=!1;a.commandHandler=ti();a.Zr=!1;a.dr=null;a.er=ub;a.mx=!1;a.dc=1;a.si=null;a.wr=1;a.zr=0;a.Vw=[0,0,0,0,0];a.Ar=0;a.rr=1;a.Qw=0;a.Rw=new J;a.Xy=500;a.Cq=new J;a.Mt=!1}R.prototype.clear=function(){this.animationManager.qc();this.model.clear();ui=null;Bi="";Ci(this,!1);this.Oo.clear();Di();this.eh.clear();this.Qa();this.Ta();this.N()};
function Ci(a,b){a.animationManager.qc(!0);a.ex=(new G).freeze();a.Nw=(new G).freeze();var c=a.skipsUndoManager,d=null!==a.Wb&&void 0!==a.Wb;d&&(a.skipsUndoManager=!0);var e=null;null!==a.Yd&&(e=a.Yd.part,null!==e&&a.remove(e));var f=[],g=a.Oa.length;if(b){for(b=0;b<g;b++)for(var h=a.Oa.m[b].parts;h.next();){var k=h.value;k!==e&&null===k.data&&f.push(k)}for(b=0;b<f.length;b++)a.remove(f[b])}for(b=0;b<g;b++)a.Oa.m[b].clear();a.partManager.clear();a.te.clear();a.Xh.clear();a.wi.clear();a.Jk=null;a.Oo.clear();
Di();a.eh.clear();Ha=[];null!==e&&(a.add(e),a.partManager.parts.remove(e));d&&(a.skipsUndoManager=c);return f}function ti(){return null}R.prototype.reset=function(){this.clear();this.qb=!0;ji(this);Ei(this);this.kh=!0;li(this);this.layout=new mi;this.kh=!1;this.model=ki();this.model.undoManager=new re;this.qb=this.Tn=!1;this.N()};
R.prototype.setRTL=function(a){a=void 0===a?this.div:a;null===a&&(a=x.document.body);var b=va("div");b.dir="rtl";b.style.cssText="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;";b.textContent="A";a.appendChild(b);var c="reverse";0<b.scrollLeft?c="default":(b.scrollLeft=1,0===b.scrollLeft&&(c="negative"));a.removeChild(b);this.Zt=c};
R.prototype.setScrollWidth=function(a){a=void 0===a?this.div:a;null===a&&(a=x.document.body);var b=0;if(Jg){var c=Fi;b=pi;null===c&&(c=Fi=va("p"),c.style.width="100%",c.style.height="200px",c.style.boxSizing="content-box",b=pi=va("div"),b.style.position="absolute",b.style.visibility="hidden",b.style.width="200px",b.style.height="150px",b.style.boxSizing="content-box",b.appendChild(c));b.style.overflow="hidden";a.appendChild(b);var d=c.offsetWidth;b.style.overflow="scroll";c=c.offsetWidth;d===c&&(c=
b.clientWidth);a.removeChild(b);b=d-c;0!==b||Ta||(b=11)}this.ub=b;this.bx=!0};R.prototype.gb=function(a){a.classType===R&&(this.autoScale=a)};R.prototype.toString=function(a){void 0===a&&(a=0);var b="";this.div&&this.div.id&&(b=this.div.id);b='Diagram "'+b+'"';if(0>=a)return b;for(var c=this.Oa.iterator;c.next();)b+="\n  "+c.value.toString(a-1);return b};R.prototype.addEventListener=function(a,b,c,d){a.addEventListener(b,c,{capture:d,passive:!1})};
R.prototype.removeEventListener=function(a,b,c,d){a.removeEventListener(b,c,{capture:d})};
function Gi(a){var b=a.Ca.La;b instanceof HTMLCanvasElement&&(a.addEventListener(b,"pointerdown",a.jk,!1),a.addEventListener(b,"pointermove",a.kk,!1),a.addEventListener(b,"pointerup",a.mk,!1),a.addEventListener(b,"pointerout",a.lk,!1),a.addEventListener(b,"pointerenter",a.zz,!1),a.addEventListener(b,"pointerleave",a.Az,!1),a.addEventListener(b,"wheel",a.gk,!1),a.addEventListener(b,"keydown",a.nA,!1),a.addEventListener(b,"keyup",a.oA,!1),a.addEventListener(b,"blur",a.kz,!1),a.addEventListener(b,"focus",
a.lz,!1),a.addEventListener(b,"selectstart",function(a){a.preventDefault();return!1},!1),a.addEventListener(b,"contextmenu",function(a){a.preventDefault();return!1},!1),a.addEventListener(x,"resize",a.Zv,!1),Ta&&a.addEventListener(b,"touchstart",function(a){a.preventDefault()},!1))}function Oe(a){30<a.zr&&(a.si=1)}function Ye(a,b){null!==a.si&&(a.si=null,b&&a.nq(),Ya&&Ya.Kx||(a.zr=0,a.Vw=[0,0,0,0,0],a.Ar=0))}
R.prototype.computePixelRatio=function(){return null!==this.si?this.si:x.devicePixelRatio||1};R.prototype.doMouseMove=function(){this.currentTool.doMouseMove()};R.prototype.doMouseDown=function(){this.currentTool.doMouseDown()};R.prototype.doMouseUp=function(){this.currentTool.doMouseUp()};R.prototype.doMouseWheel=function(){this.currentTool.doMouseWheel()};R.prototype.doKeyDown=function(){this.currentTool.doKeyDown()};R.prototype.doKeyUp=function(){this.currentTool.doKeyUp()};
R.prototype.doFocus=function(){this.focus()};R.prototype.focus=function(){if(this.Ca)if(this.scrollsPageOnFocus)this.Ca.focus();else{var a=x.scrollX||x.pageXOffset,b=x.scrollY||x.pageYOffset;this.Ca.focus();x.scrollTo(a,b)}};R.prototype.lz=function(){this.C.S("GainedFocus")};R.prototype.kz=function(){this.C.S("LostFocus")};
function nh(a){if(null!==a.Ca){var b=a.Ga;if(null!==b&&0!==b.clientWidth&&0!==b.clientHeight){a.bx||a.setScrollWidth();var c=a.Sf?a.ub:0,d=a.Ye?a.ub:0,e=a.dc;a.dc=a.computePixelRatio();a.dc!==e&&(a.Qn=!0,a.Fb());if(b.clientWidth!==a.ua+c||b.clientHeight!==a.ta+d)a.kj=!0,a.Wc=!0,b=a.layout,null!==b&&b.isViewportSized&&a.autoScale===mh&&(a.Qk=!0,b.B()),a.Xc||a.Fb()}}}
function li(a){var b=new $h;b.name="Background";a.Sl(b);b=new $h;b.name="";a.Sl(b);b=new $h;b.name="Foreground";a.Sl(b);b=new $h;b.name="Adornment";b.isTemporary=!0;b.isInDocumentBounds=!1;a.Sl(b);b=new $h;b.name="Tool";b.isTemporary=!0;b.isInDocumentBounds=!0;a.Sl(b);b=new $h;b.name="Grid";b.allowSelect=!1;b.pickable=!1;b.isTemporary=!0;b.isInDocumentBounds=!1;a.tx(b,a.Xj("Background"))}
function Hi(a){var b=new X(X.Grid);b.name="GRID";var c=new xf;c.figure="LineH";c.stroke="lightgray";c.strokeWidth=.5;c.interval=1;b.add(c);c=new xf;c.figure="LineH";c.stroke="gray";c.strokeWidth=.5;c.interval=5;b.add(c);c=new xf;c.figure="LineH";c.stroke="gray";c.strokeWidth=1;c.interval=10;b.add(c);c=new xf;c.figure="LineV";c.stroke="lightgray";c.strokeWidth=.5;c.interval=1;b.add(c);c=new xf;c.figure="LineV";c.stroke="gray";c.strokeWidth=.5;c.interval=5;b.add(c);c=new xf;c.figure="LineV";c.stroke=
"gray";c.strokeWidth=1;c.interval=10;b.add(c);c=new V;c.add(b);c.layerName="Grid";c.zOrder=0;c.isInDocumentBounds=!1;c.isAnimated=!1;c.pickable=!1;c.locationObjectName="GRID";a.add(c);a.partManager.parts.remove(c);b.visible=!1;return b}function Ii(){this.C.cu?this.C.cu=!1:this.C.isEnabled?this.C.Gx(this):Ji(this.C)}function Ki(a){this.C.isEnabled?(this.C.gu=a.target.scrollTop,this.C.eu=a.target.scrollLeft):Ji(this.C)}
R.prototype.Gx=function(a){if(null!==this.Ca){var b=this.fu,c=this.du;this.Nr=!0;var d=this.documentBounds,e=this.viewportBounds,f=this.Fj,g=d.x-f.left,h=d.y-f.top,k=d.width+f.left+f.right,l=d.height+f.top+f.bottom,m=d.right+f.right;f=d.bottom+f.bottom;var n=e.x;d=e.y;var p=e.width,r=e.height,q=e.right,u=e.bottom;e=this.scale;var w=a.scrollLeft;if(this.Vn)switch(this.Zt){case "negative":w=w+a.scrollWidth-a.clientWidth;break;case "reverse":w=a.scrollWidth-w-a.clientWidth}var v=w;p<k||r<l?(w=J.allocAt(this.position.x,
this.position.y),this.allowHorizontalScroll&&this.eu!==v&&(w.x=v/e+g,this.eu=v),this.allowVerticalScroll&&this.gu!==a.scrollTop&&(w.y=a.scrollTop/e+h,this.gu=a.scrollTop),this.position=w,J.free(w),this.kj=this.Nr=!1):(w=J.alloc(),a.Sy&&this.allowHorizontalScroll&&(g<n&&(this.position=w.h(v+g,this.position.y)),m>q&&(this.position=w.h(-(b.scrollWidth-this.ua)+v-this.ua/e+m,this.position.y))),a.Ty&&this.allowVerticalScroll&&(h<d&&(this.position=w.h(this.position.x,a.scrollTop+h)),f>u&&(this.position=
w.h(this.position.x,-(b.scrollHeight-this.ta)+a.scrollTop-this.ta/e+f))),J.free(w),Li(this),this.kj=this.Nr=!1,d=this.documentBounds,e=this.viewportBounds,m=d.right,q=e.right,f=d.bottom,u=e.bottom,g=d.x,n=e.x,h=d.y,d=e.y,p>=k&&g>=n&&m<=q&&(c.style.width="1px"),r>=l&&h>=d&&f<=u&&(c.style.height="1px"))}};R.prototype.computeBounds=function(a){void 0===a&&(a=new M);hh(this);return Mi(this,a)};
function Mi(a,b){if(a.fixedBounds.u())return b.assign(a.fixedBounds),b.Lp(a.nb),b;for(var c=!0,d=a.Oa.m,e=d.length,f=0;f<e;f++){var g=d[f];if(g.visible&&g.isInDocumentBounds){g=g.Ha.m;for(var h=g.length,k=0;k<h;k++){var l=g[k];l.isInDocumentBounds&&l.isVisible()&&(l=l.actualBounds,l.u()&&(c?(c=!1,b.assign(l)):b.Rc(l)))}}}c&&b.h(0,0,0,0);b.Lp(a.nb);return b}
R.prototype.computePartsBounds=function(a,b){void 0===b&&(b=!1);var c=null;if(Aa(a))for(var d=0;d<a.length;d++){var e=a[d];!b&&e instanceof T||(e.Ta(),null===c?c=e.actualBounds.copy():c.Rc(e.actualBounds))}else for(a=a.iterator;a.next();)d=a.value,!b&&d instanceof T||(d.Ta(),null===c?c=d.actualBounds.copy():c.Rc(d.actualBounds));return null===c?new M(NaN,NaN,0,0):c};
function Ni(a,b){if((b||a.Uf)&&!a.qb&&null!==a.Ca&&a.documentBounds.u()){if(b){var c=a.initialPosition;if(c.u()){a.position=c;return}c=J.alloc();c.Ti(a.documentBounds,a.initialDocumentSpot);var d=a.viewportBounds;d=M.allocAt(0,0,d.width,d.height);var e=J.alloc();e.Ti(d,a.initialViewportSpot);e.h(c.x-e.x,c.y-e.y);a.position=e;M.free(d);J.free(e);J.free(c)}a.qb=!0;c=a.Ph;b&&a.Qg!==mh&&(c=a.Qg);var f=c!==mh?Oi(a,c):a.scale;c=a.ja.x;d=a.ja.y;e=a.ua/f;var g=a.ta/f,h=a.Gk,k=a.hr;b&&!h.hb()&&(k.hb()||k.Mb())&&
(h=k.Mb()?xc:k);Pi(a,a.documentBounds,e,g,h,b);b=a.scale;a.scale=f;a.qb=!1;Qi(a);Ri(a,!0,!1);f=a.viewportBounds;if(!(L.w(f.x,c)&&L.w(f.y,d)&&L.w(f.width,e)&&L.w(f.height,g)))a.onViewportBoundsChanged(new M(c,d,e,g),f,b,!1)}}
function Oi(a,b){var c=a.Rq;if(null===a.Ca)return c;a.Ta();var d=a.documentBounds;if(!d.u())return c;var e=d.width;d=d.height;var f=a.ua+(a.Sf?a.ub:0),g=a.ta+(a.Ye?a.ub:0),h=f/e,k=g/d;return b===Si?(b=Math.min(k,h),b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):b===Ti?(b=k>h?(g-a.ub)/d:(f-a.ub)/e,b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):a.scale}
R.prototype.zoomToFit=function(){var a=this.Gj;this.Gj=Nh;this.scale=Oi(this,Si);a!==Nh&&(Ni(this,!1),Pi(this,this.documentBounds,this.ua/this.sa,this.ta/this.sa,this.Gk,!1));this.Gj=a};t=R.prototype;
t.$A=function(a,b){void 0===b&&(b=Si);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===Si||b===Ti)if(isNaN(c))e=this.viewportBounds.height*this.scale/d;else if(isNaN(d))e=this.viewportBounds.width*this.scale/c;else{e=this.ua;var f=this.ta;e=b===Ti?f/d>e/c?(f-(this.Ye?this.ub:0))/d:(e-(this.Sf?this.ub:0))/c:Math.min(f/d,e/c)}this.scale=e;this.position=new J(a.x,a.y)}};
t.ez=function(a,b){this.Ta();var c=this.documentBounds,d=this.viewportBounds;this.position=new J(c.x+(a.x*c.width+a.offsetX)-(b.x*d.width-b.offsetX),c.y+(a.y*c.height+a.offsetY)-(b.y*d.height-b.offsetY))};t.Xz=function(a){if(a instanceof Y){this.dr=a;var b=J.alloc();this.er=this.vq(a.da(tc,b));J.free(b)}else this.dr=null,this.er=ub};
function Pi(a,b,c,d,e,f){var g=J.allocAt(a.ja.x,a.ja.y),h=g.x,k=g.y;if(null!==a.dr){var l=J.alloc();l=a.dr.da(tc,l);h=l.x-a.er.x/a.scale;k=l.y-a.er.y/a.scale;e=qc;J.free(l)}if(f||a.scrollMode===Nh)e.hb()&&(c>b.width&&(h=b.x+(e.x*b.width+e.offsetX)-(e.x*c-e.offsetX)),d>b.height&&(k=b.y+(e.y*b.height+e.offsetY)-(e.y*d-e.offsetY))),e=a.Fj,f=c-b.width,c<b.width+e.left+e.right?(h=Math.min(h+c/2,b.right+Math.max(f,e.right)-c/2),h=Math.max(h,b.left-Math.max(f,e.left)+c/2),h-=c/2):h>b.left?h=b.left:h<b.right-
c&&(h=b.right-c),c=d-b.height,d<b.height+e.top+e.bottom?(k=Math.min(k+d/2,b.bottom+Math.max(c,e.bottom)-d/2),k=Math.max(k,b.top-Math.max(c,e.top)+d/2),k-=d/2):k>b.top?k=b.top:k<b.bottom-d&&(k=b.bottom-d);g.x=isFinite(h)?h:-a.nb.left;g.y=isFinite(k)?k:-a.nb.top;null!==a.positionComputation&&(b=a.positionComputation(a,g),g.x=b.x,g.y=b.y);Jh(a.Pd,a.ja,g);a.ja.h(g.x,g.y);Ei(a);J.free(g)}
t.Zl=function(a,b){void 0===b&&(b=!0);if(b){if(a=mf(this,a,function(a){return a.part},function(a){return a.canSelect()}),a instanceof V)return a}else if(a=mf(this,a,function(a){return a.part}),a instanceof V)return a;return null};t.Zb=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);hh(this);for(var d=this.Oa.iteratorBackwards;d.next();){var e=d.value;if(e.visible&&(e=e.Zb(a,b,c),null!==e))return e}return null};
function mf(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);hh(a);for(a=a.Oa.iteratorBackwards;a.next();){var e=a.value;if(e.visible&&!e.isTemporary&&(e=e.Zb(b,c,d),null!==e))return e}return null}t.Kz=function(a,b,c){void 0===b&&(b=!0);return Ui(this,a,function(a){return a.part},b?function(a){return a instanceof V&&a.canSelect()}:null,c)};
function Ui(a,b,c,d,e){void 0===c&&(c=null);void 0===d&&(d=null);e instanceof F||e instanceof G||(e=new G);hh(a);for(a=a.Oa.iteratorBackwards;a.next();){var f=a.value;f.visible&&!f.isTemporary&&f.Hi(b,c,d,e)}return e}t.Hi=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof F||d instanceof G||(d=new G);hh(this);for(var e=this.Oa.iteratorBackwards;e.next();){var f=e.value;f.visible&&f.Hi(a,b,c,d)}return d};
t.Px=function(a,b,c,d){void 0===b&&(b=!1);void 0===c&&(c=!0);return Vi(this,a,function(a){return a instanceof V&&(!c||a.canSelect())},b,d)};t.zf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof F||e instanceof G||(e=new G);hh(this);for(var f=this.Oa.iteratorBackwards;f.next();){var g=f.value;g.visible&&g.zf(a,b,c,d,e)}return e};
t.Qu=function(a,b,c,d,e,f){var g=new G;hh(this);for(var h=this.Oa.iteratorBackwards;h.next();){var k=h.value;k.visible&&k.Qu(a,b,c,d,g,e,f)}return g};function Vi(a,b,c,d,e){var f=null;void 0===f&&(f=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof F||e instanceof G||(e=new G);hh(a);for(a=a.Oa.iteratorBackwards;a.next();){var g=a.value;g.visible&&!g.isTemporary&&g.zf(b,f,c,d,e)}return e}
t.Lz=function(a,b,c,d,e){void 0===c&&(c=!0);void 0===d&&(d=!0);return Wi(this,a,b,function(a){return a instanceof V&&(!d||a.canSelect())},c,e)};t.pg=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof F||e instanceof G)f=e;e=!0}f instanceof F||f instanceof G||(f=new G);hh(this);for(var g=this.Oa.iteratorBackwards;g.next();){var h=g.value;h.visible&&h.pg(a,b,c,d,e,f)}return f};
function Wi(a,b,c,d,e,f){var g=null;void 0===g&&(g=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof F||e instanceof G)f=e;e=!0}f instanceof F||f instanceof G||(f=new G);hh(a);for(a=a.Oa.iteratorBackwards;a.next();){var h=a.value;h.visible&&!h.isTemporary&&h.pg(b,c,g,d,e,f)}return f}R.prototype.acceptEvent=function(a){return Xi(this,a,a instanceof MouseEvent)};
function Xi(a,b,c){var d=a.gh;a.gh=a.rj;a.rj=d;d.diagram=a;d.event=b;c?Yi(a,b,d):(d.viewPoint=a.gh.viewPoint,d.documentPoint=a.gh.documentPoint);a=0;b.ctrlKey&&(a+=1);b.altKey&&(a+=2);b.shiftKey&&(a+=4);b.metaKey&&(a+=8);d.modifiers=a;d.button=b.button;void 0!==b.buttons&&(d.buttons=b.buttons);Ta&&0===b.button&&b.ctrlKey&&(d.button=2);d.down=!1;d.up=!1;d.clickCount=1;d.delta=0;d.handled=!1;d.bubbles=!1;d.timestamp=b.timeStamp;d.isMultiTouch=!1;d.targetDiagram=Zi(b,b.target);d.targetObject=null;return d}
function Zi(a,b){if(null===b)return null;if(b=b.C)return b;(b=a.path)||"function"!==typeof a.composedPath||(b=a.composedPath());return b&&b[0]&&b[0].C?b[0].C:null}
function $i(a,b,c,d,e,f){var g=a.gh;a.gh=a.rj;a.rj=g;g.diagram=a;g.clickCount=1;a=g.delta=0;b.ctrlKey&&(a+=1);b.altKey&&(a+=2);b.shiftKey&&(a+=4);b.metaKey&&(a+=8);g.modifiers=a;g.event=b;g.timestamp=b.timeStamp;g.button=b.button;g.buttons=b.buttons;Ta&&0===b.button&&b.ctrlKey&&(g.button=2);g.down=c;g.up=d;g.handled=!1;g.bubbles=e;g.isMultiTouch=f;return g}
function aj(a,b){if(a.bubbles)return!0;void 0!==b.stopPropagation&&b.stopPropagation();!1!==b.cancelable&&b.preventDefault();b.cancelBubble=!0;return!1}
R.prototype.nA=function(a){var b=this.C;if(!this.C.isEnabled)return!1;var c=Xi(b,a,!1);c.key=String.fromCharCode(a.which);c.down=!0;switch(a.which){case 8:c.key="Backspace";break;case 33:c.key="PageUp";break;case 34:c.key="PageDown";break;case 35:c.key="End";break;case 36:c.key="Home";break;case 37:c.key="Left";break;case 38:c.key="Up";break;case 39:c.key="Right";break;case 40:c.key="Down";break;case 45:c.key="Insert";break;case 46:c.key="Del";break;case 48:c.key="0";break;case 187:case 61:case 107:c.key=
"Add";break;case 189:case 173:case 109:c.key="Subtract";break;case 27:c.key="Esc"}b.doKeyDown();return aj(c,a)};
R.prototype.oA=function(a){var b=this.C;if(!b.isEnabled)return!1;var c=Xi(b,a,!1);c.key=String.fromCharCode(a.which);c.up=!0;switch(a.which){case 8:c.key="Backspace";break;case 33:c.key="PageUp";break;case 34:c.key="PageDown";break;case 35:c.key="End";break;case 36:c.key="Home";break;case 37:c.key="Left";break;case 38:c.key="Up";break;case 39:c.key="Right";break;case 40:c.key="Down";break;case 45:c.key="Insert";break;case 46:c.key="Del"}b.doKeyUp();return aj(c,a)};
R.prototype.zz=function(a){var b=this.C;if(!b.isEnabled)return!1;var c=Xi(b,a,!0);null!==b.mouseEnter&&b.mouseEnter(c);return aj(c,a)};R.prototype.Az=function(a){var b=this.C;if(!b.isEnabled)return!1;var c=Xi(b,a,!0);null!==b.mouseLeave&&b.mouseLeave(c);return aj(c,a)};
R.prototype.getMouse=function(a){var b=this.Ca;if(null===b)return new J(0,0);var c=b.getBoundingClientRect();b=a.clientX-this.ua/c.width*c.left;a=a.clientY-this.ta/c.height*c.top;return null!==this.vb?yb(new J(b,a),this.vb):new J(b,a)};
function Yi(a,b,c){var d=a.Ca,e=a.ua,f=a.ta,g=0,h=0;null!==d&&(d=d.getBoundingClientRect(),g=b.clientX-e/d.width*d.left,h=b.clientY-f/d.height*d.top);c.viewPoint.h(g,h);null!==a.vb?(b=J.allocAt(g,h),a.vb.Hd(b),c.documentPoint.assign(b),J.free(b)):c.documentPoint.h(g,h)}
function de(a,b,c,d){if(void 0!==b.targetTouches){if(2>b.targetTouches.length)return;b=b.targetTouches[c]}else if(null!==a.ul[0])b=a.ul[c];else return;c=a.Ca;null!==c&&(c=c.getBoundingClientRect(),d.h(b.clientX-a.ua/c.width*c.left,b.clientY-a.ta/c.height*c.top))}R.prototype.Qa=function(){this.jj||(this.jj=!0,this.Fb(!0))};function bj(a){a.Xc||hh(a);a.Ta()}R.prototype.redraw=function(){this.qb||this.Xc||(this.N(),Qi(this),this.hd())};t=R.prototype;t.mA=function(){return this.jg};
t.uz=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.qc();b.isEnabled=!1;uf(this);this.Uf=!1;this.au=new J(NaN,NaN);b.isEnabled=c;this.Xc=!0;var d=this;null!==a&&ua(function(){d.Xc=!1;gh(b,"Model");a(d)},1)};t.Fb=function(a){void 0===a&&(a=!1);if(!0!==this.jg&&!(this.qb||!1===a&&this.Xc)){this.jg=!0;var b=this;x.requestAnimationFrame(function(){b.jg&&b.hd()})}};t.hd=function(){if(!this.zn||this.jg)this.zn&&(this.zn=!1),uf(this)};
function Ri(a,b,c){a.animationManager.defaultAnimation.isAnimating||a.qb||!a.kj||Ji(a)||(b&&hh(a),c&&Ni(a,!1))}
function uf(a,b){if(!a.Xc&&(a.jg=!1,null!==a.Ga||a.Fp.u())){a.Xc=!0;var c=a.animationManager,d=a.Oo;if(!c.isAnimating&&0!==d.length){for(var e=d.m,f=e.length,g=0;g<f;g++){var h=e[g];cj(h,!1);h.s()}d.clear()}d=a.Ow;0<d.count&&(d.each(function(a){a.Xv()}),d.clear());e=d=!1;c.defaultAnimation.isAnimating&&(e=!0,d=a.skipsUndoManager,a.skipsUndoManager=!0);c.tb||nh(a);Ri(a,!1,!0);null!==a.Yd&&(a.Yd.visible&&!a.fr&&(dj(a),a.fr=!0),!a.Yd.visible&&a.fr&&(a.fr=!1));hh(a);f=!1;if(!a.Uf||a.Oh)a.Uf?ej(a,!a.Qk):
(a.xa("Initial Layout"),!1===c.isEnabled&&c.qc(),ej(a,!1)),f=!0;a.Qk=!1;hh(a);a.hu||bj(a);Ri(a,!0,!1);g=!1;f?(c=M.alloc(),c.assign(a.viewportBounds),a.Uf||(g=a.Uf=!0,a.skipsUndoManager||(a.undoManager.isPendingClear=!0),a.undoManager.isPendingUnmodified=!0,fj(a)),a.S("LayoutCompleted"),c.A(a.viewportBounds)||Ri(a,!0,!1),M.free(c)):c.Xk&&c.nx&&(a.Qg!==mh?a.scale=Oi(a,a.Qg):a.Ph!==mh?a.scale=Oi(a,a.Ph):(c=a.initialScale,isFinite(c)&&0<c&&(a.scale=c)),Ni(a,!0));hh(a);f&&g&&a.Xa("Initial Layout");a.Au();
b||a.oc(a.Vb);e&&(a.skipsUndoManager=d);a.Xc=!1}}function fj(a){var b=a.sa;if(a.Qg!==mh)a.scale=Oi(a,a.Qg);else if(a.Ph!==mh)a.scale=Oi(a,a.Ph);else{var c=a.initialScale;isFinite(c)&&0<c&&(a.scale=c)}a.sa!==b&&(Qi(a),Ri(a,!0,!1));Ni(a,!0);b=a.Oa.m;a.Md(b,b.length,a,a.viewportBounds);a.S("InitialLayoutCompleted");a.au.assign(a.ja);dj(a)}
function hh(a){if(0!==a.te.count&&(a.Xc||!a.animationManager.isTicking)){for(var b=0;23>b;b++){var c=a.te.iterator;if(null===c||0===a.te.count)break;a.te=new G;a.Xv(c,a.te)}a.nodes.each(function(a){a instanceof U&&0!==(a.R&65536)!==!1&&(a.R=a.R^65536)})}}
t.Xv=function(a,b){for(a.reset();a.next();){var c=a.value;!c.Nc()||c instanceof U||(c.Ri()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof U&&c.isVisible()&&gj(this,c);for(a.reset();a.next();)c=a.value,c instanceof T&&c.isVisible()&&(c.Ri()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof ye&&c.isVisible()&&(c.Ri()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))};
function gj(a,b){for(var c=Ga(),d=Ga(),e=b.memberParts;e.next();){var f=e.value;f.isVisible()&&(f instanceof U?(hj(f)||ij(f)||jj(f))&&gj(a,f):f instanceof T?f.fromNode===b||f.toNode===b?d.push(f):c.push(f):(f.measure(Infinity,Infinity),f.arrange()))}a=c.length;for(e=0;e<a;e++)f=c[e],f.measure(Infinity,Infinity),f.arrange();Ja(c);b.measure(Infinity,Infinity);b.arrange();a=d.length;for(b=0;b<a;b++)c=d[b],c.measure(Infinity,Infinity),c.arrange();Ja(d)}
t.Md=function(a,b,c,d){if(this.lj||this.animationManager.isAnimating)for(var e=0;e<b;e++)a[e].Md(c,d)};
t.oc=function(a,b){if(null!==this.Ga){null===this.Ca&&C("No canvas specified");var c=this.animationManager;if(!c.tb&&(!c.isAnimating||c.isTicking)){var d=new Date;kj(this);if("0"!==this.Ga.style.opacity){var e=a!==this.Vb,f=this.Oa.m,g=f.length,h=this;this.Md(f,g,h,h.viewportBounds);if(e)a.Ic(!0),Li(this);else if(!this.Wc&&void 0===b&&!c.isAnimating)return;g=this.ja;var k=this.sa,l=Math.round(g.x*k)/k,m=Math.round(g.y*k)/k;c=this.vb;c.reset();1!==k&&c.scale(k);0===g.x&&0===g.y||c.translate(-l,-m);
k=this.dc;a.setTransform(k,0,0,k,0,0);a.clearRect(0,0,this.ua,this.ta);1!==this.mb&&(a.globalAlpha=this.mb);lj(this,a);l=void 0!==b?function(c){if(c.visible&&0!==c.mb){var d=c.Ha.m,e=d.length;if(0!==e){var f=bi(c,a),g=c.Jo;g.length=0;for(var k=h.scale,l=M.alloc(),m=0;m<e;m++){var n=d[m];b.contains(n)||c.Di(a,n,h,g,k,l,!0)}M.free(l);a.globalAlpha=f}}}:function(b){b.oc(a,h)};g=f.length;for(m=0;m<g;m++)a.setTransform(k,0,0,k,0,0),a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),l(f[m]);f=!1;this.Zh?mj(this.Zh,
this)&&(f=this.zt()):f=!0;f&&(nd.prototype.Hd=nd.prototype.yx);e?(this.Vb.Ic(!0),Li(this)):this.Wc=this.lj=!1;f=+new Date-+d;e=Ya&&Ya.Kx;d=this.Vw;if(e||null===this.si){d[this.Ar]=f;this.Ar=(this.Ar+1)%d.length;for(c=f=0;c<d.length;c++)f+=d[c];this.zr=f/d.length}1!==this.mb&&(a.globalAlpha=1);if(e)for(a.setTransform(1,0,0,1,0,0),e=0;e<d.length;e++)a.fillText(d[e].toString(),20,150+ +(20*e))}}}};
function nj(a,b,c,d,e,f,g,h,k,l){if(null!==a.Ga){null===a.Ca&&C("No canvas specified");void 0===g&&(g=null);void 0===h&&(h=null);void 0===k&&(k=!1);void 0===l&&(l=!1);kj(a);a.Vb.Ic(!0);Li(a);a.nj=!0;var m=a.sa;a.sa=e;var n=a.Oa.m,p=n.length;try{var r=new M(f.x,f.y,d.width/e,d.height/e),q=r.copy();q.Lp(c);dj(a,q);hh(a);a.Md(n,p,a,r);b.setTransform(1,0,0,1,0,0);b.clearRect(0,0,d.width,d.height);null!==h&&""!==h&&(b.fillStyle=h,b.fillRect(0,0,d.width,d.height));var u=a.dc;b.scale(u,u);var w=nd.alloc();
w.reset();w.translate(c.left,c.top);w.scale(e);0===f.x&&0===f.y||w.translate(-f.x,-f.y);b.setTransform(w.m11,w.m12,w.m21,w.m22,w.dx,w.dy);nd.free(w);lj(a,b);b.globalAlpha=a.mb;var v=a.Xj("Grid");if(g){var A=new G,y=g.iterator;for(y.reset();y.next();){var B=y.value;B instanceof V&&(l||B.layer!==v)&&A.add(B)}for(l=0;l<p;l++){var z=n[l];v=b;var E=a;if(z.visible&&0!==z.mb&&(k||!z.isTemporary)){var K=z.Ha.m,O=K.length;if(0!==O){var S=bi(z,v),Q=z.Jo;Q.length=0;var H=E.scale,da=M.alloc();for(c=0;c<O;c++){var ba=
K[c];A.contains(ba)&&z.Di(v,ba,E,Q,H,da,!1)}M.free(da);v.globalAlpha=S}}}}else for(A=0;A<p;A++)E=n[A],E===v?l&&E.oc(b,a,!0):E.oc(b,a,k);a.nj=!1;a.Zh&&mj(a.Zh,a)&&a.zt()}finally{a.sa=m,a.Vb.Ic(!0),Li(a),a.Md(n,p,a,a.viewportBounds),dj(a)}}}t.Ie=function(a){return this.hh[a]};t.wy=function(a,b){"minDrawingLength"===a&&(this.wr=b);this.hh[a]=b;this.redraw()};
t.sy=function(){this.hh=new Xa;this.hh.drawShadows=!0;this.hh.textGreeking=!0;this.hh.viewportOptimizations=Ta||Ra?!1:!0;this.hh.temporaryPixelRatio=!0;this.hh.pictureRatioOptimization=!0;this.wr=this.hh.minDrawingLength=1};function lj(a,b){a=a.hh;null!==a&&(void 0!==a.imageSmoothingEnabled&&b.vy(!!a.imageSmoothingEnabled),a=a.defaultFont,void 0!==a&&null!==a&&(b.font=a))}t.am=function(a){return this.Pn[a]};t.OA=function(a,b){this.Pn[a]=b};
t.qy=function(){this.Pn=new Xa;this.Pn.extraTouchArea=10;this.Pn.extraTouchThreshold=10;this.Pn.hasGestureZoom=!0};t.set=function(a){Object.assign(this,a);return this};t.wu=function(a){return this.xm(a)};t.xm=function(a){oj(this,a);return this};
function oj(a,b){var c=a instanceof X,d=a instanceof R,e;for(e in b){""===e&&C("Setting properties requires non-empty property names");var f=a,g=e;if(c||d){var h=e.indexOf(".");if(0<h){var k=e.substring(0,h);if(c)f=a.Ya(k);else if(f=a[k],void 0===f||null===f)f=a.toolManager[k];za(f)?g=e.substr(h+1):C("Unable to find object named: "+k+" in "+a.toString()+" when trying to set property: "+e)}}if("_"!==g[0]&&!Ma(f,g))if(d&&"ModelChanged"===g){a.vx(b[g]);continue}else if(d&&"Changed"===g){a.yh(b[g]);continue}else if(d&&
Ma(a.toolManager,g))f=a.toolManager;else if(d&&pj(a,g)){a.Lj(g,b[g]);continue}else if(a instanceof Z&&"Changed"===g){a.yh(b[g]);continue}else C('Trying to set undefined property "'+g+'" on object: '+f.toString());f[g]=b[e];"_"===g[0]&&f instanceof Y&&f.sx(g)}}t.Au=function(){if(0===this.undoManager.transactionLevel&&0!==this.Xh.count){for(;0<this.Xh.count;){var a=this.Xh;this.Xh=new I;for(a=a.iterator;a.next();){var b=a.key;b.eq(a.value);b.fc(!1)}}this.N()}};
t.N=function(a){if(void 0===a)this.Wc=!0,this.Fb();else{var b=this.viewportBounds;a.u()&&b.Mc(a)&&(this.Wc=!0,this.Fb())}this.S("InvalidateDraw")};
R.prototype.invalidateViewport=function(a,b){if(!0!==this.Wc){this.Wc=!0;var c=!0===this.Ie("temporaryPixelRatio");if(!0===this.Ie("viewportOptimizations")&&this.scrollMode!==Ph&&this.Fj.Fi(0,0,0,0)&&b.width===a.width&&b.height===a.height){var d=this.scale,e=Math.max(a.x,b.x),f=Math.max(a.y,b.y);d=M.allocAt(e,f,Math.max(0,Math.min(a.x+a.width,b.x+b.width)-e)*d,Math.max(0,Math.min(a.y+a.height,b.y+b.height)-f)*d);if(!this.Zr&&0<d.width&&0<d.height){if(!(this.Xc||(this.jg=!1,null===this.Ga||(this.Xc=
!0,this.Au(),this.documentBounds.u()||(e=M.alloc(),qj(this,this.computeBounds(e)),M.free(e)),e=this.Ca,null===e||e instanceof rj)))){var g=this.dc;f=this.ua*g;var h=this.ta*g,k=this.scale*g,l=Math.round(Math.round(b.x*k)-Math.round(a.x*k));b=Math.round(Math.round(b.y*k)-Math.round(a.y*k));k=this.Iw;a=this.Ny;k.width!==f&&(k.width=f);k.height!==h&&(k.height=h);a.clearRect(0,0,f,h);k=190*g;var m=70*g,n=Math.max(l,0),p=Math.max(b,0),r=Math.floor(f-n),q=Math.floor(h-p);a.drawImage(e.La,n,p,r,q,0,0,r,
q);mj(this.Zh,this)&&a.clearRect(0,0,k,m);e=Ga();a=Ga();q=Math.abs(l);r=Math.abs(b);var u=0===n?0:f-q;n=J.allocAt(u,0);q=J.allocAt(q+u,h);a.push(new M(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));var w=this.vb;w.reset();w.scale(g,g);1!==this.sa&&w.scale(this.sa);g=this.ja;(0!==g.x||0!==g.y)&&isFinite(g.x)&&isFinite(g.y)&&w.translate(-g.x,-g.y);yb(n,w);yb(q,w);e.push(new M(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));u=0===p?0:h-r;n.h(0,u);
q.h(f,r+u);a.push(new M(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));yb(n,w);yb(q,w);e.push(new M(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));mj(this.Zh,this)&&(f=0<l?0:-l,h=0<b?0:-b,n.h(f,h),q.h(k+f,m+h),a.push(new M(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))),yb(n,w),yb(q,w),e.push(new M(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))));J.free(n);J.free(q);Ri(this,!1,!0);null===this.Ga&&
C("No div specified");null===this.Ca&&C("No canvas specified");if(!this.animationManager.tb&&(f=this.Vb,this.Wc)){kj(this);h=this.dc;f.setTransform(1,0,0,1,0,0);f.clearRect(0,0,this.ua*h,this.ta*h);f.drawImage(this.Iw.La,0<l?0:Math.round(-l),0<b?0:Math.round(-b));l=this.ja;g=this.sa;k=Math.round(l.x*g)/g;m=Math.round(l.y*g)/g;b=this.vb;b.reset();1!==g&&b.scale(g);0===l.x&&0===l.y||b.translate(-k,-m);f.save();f.beginPath();l=a.length;for(g=0;g<l;g++)k=a[g],0!==k.width&&0!==k.height&&f.rect(Math.floor(k.x),
Math.floor(k.y),Math.ceil(k.width),Math.ceil(k.height));f.clip();f.setTransform(1,0,0,1,0,0);f.scale(h,h);f.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy);b=this.Oa.m;l=b.length;this.Md(b,l,this,this.viewportBounds);lj(this,f);f.globalAlpha=this.mb;for(h=0;h<l;h++)if(g=b[h],k=e,g.visible&&0!==g.mb){m=bi(g,f);p=g.Jo;p.length=0;n=this.scale;r=M.alloc();q=g.Ha.m;w=q.length;u=k.length;for(var v=0;v<w;v++){var A=q[v],y=sj(A,A.actualBounds);a:{for(var B=2/n,z=4/n,E=0;E<u;E++){var K=k[E];if(0!==K.width&&0!==
K.height&&y.av(K.x-B,K.y-B,K.width+z,K.height+z)){y=!0;break a}}y=!1}y&&g.Di(f,A,this,p,n,r,!0)}M.free(r);f.globalAlpha=m}f.restore();f.Ic(!0);this.Zh&&mj(this.Zh,this)&&this.zt();this.Wc=this.lj=!1;this.nq()}Ja(e);Ja(a);this.Xc=!1}}else this.hd();M.free(d);c&&(Oe(this),this.hd(),Ye(this,!0))}else c?(Oe(this),this.hd(),Ye(this,!0)):this.hd()}};function Qi(a){!1===a.kj&&(a.kj=!0)}function Li(a){!1===a.lj&&(a.lj=!0)}function kj(a){!1!==a.Qn&&(a.Qn=!1,tj(a,a.ua,a.ta))}
function tj(a,b,c){Ei(a);var d=a.dc;a.Ca.resize(b*d,c*d,b,c)&&(a.Wc=!0,a.Vb.Ic(!0))}
function Ji(a){var b=a.Ca;if(null===b||a.Fp.u())return!0;var c=a.ua,d=a.ta,e=a.viewportBounds;if(!a.viewportBounds.u())return!0;var f=e.x,g=e.y,h=e.width,k=e.height,l=a.fu,m=a.du,n=a.Ga,p=!1,r=a.Sf?a.ub:0,q=a.Ye?a.ub:0,u=n.clientWidth||c+r,w=n.clientHeight||d+q;if(u!==c+r||w!==d+q)a.Sf=!1,a.Ye=!1,q=r=0,a.ua=u,a.ta=w,p=a.Qn=!0,Ei(a);if(!(p||a.Sf||a.Ye||a.Mn||a.Nn))return!0;a.kj=!1;var v=a.documentBounds,A=0,y=0,B=0,z=0;n=e.width;var E=e.height,K=a.Fj;a.contentAlignment.hb()?(v.width>n&&(A=K.left,y=
K.right),v.height>E&&(B=K.top,z=K.bottom)):(A=K.left,y=K.right,B=K.top,z=K.bottom);K=v.width+A+y;var O=v.height+B+z;A=v.x-A;var S=e.x;y=v.right+y;var Q=e.right+r;B=v.y-B;var H=e.y;v=v.bottom+z;z=e.bottom+q;var da="1px",ba="1px";e=a.scale;u=K>u/e;w=O>w/e;a.scrollMode===Nh&&(u||w)&&(u&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(u=1,A+1<S&&(u=Math.max((S-A)*e+a.ua,u)),y>Q+1&&(u=Math.max((y-Q)*e+a.ua,u)),n+r+1<K&&(u=Math.max((K-n)*e+a.ua,u)),da=u.toString()+"px"),w&&a.hasVerticalScrollbar&&a.allowVerticalScroll&&
(u=1,B+1<H&&(u=Math.max((H-B)*e+a.ta,u)),v>z+1&&(u=Math.max((v-z)*e+a.ta,u)),E+q+1<O&&(u=Math.max((O-E)*e+a.ta,u)),ba=u.toString()+"px"));u="1px"!==da;w="1px"!==ba;u&&w||!u&&!w||(w&&(Q-=a.ub),u&&(z-=a.ub),K<n+r||!a.hasHorizontalScrollbar||!a.allowHorizontalScroll||(r=1,A+1<S&&(r=Math.max((S-A)*e+a.ua,r)),y>Q+1&&(r=Math.max((y-Q)*e+a.ua,r)),n+1<K&&(r=Math.max((K-n)*e+a.ua,r)),da=r.toString()+"px"),u="1px"!==da,r=a.ta,u!==a.Ye&&(r=u?a.ta-a.ub:a.ta+a.ub),O<E+q||!a.hasVerticalScrollbar||!a.allowVerticalScroll||
(q=1,B+1<H&&(q=Math.max((H-B)*e+r,q)),v>z+1&&(q=Math.max((v-z)*e+r,q)),E+1<O&&(q=Math.max((O-E)*e+r,q)),ba=q.toString()+"px"),w="1px"!==ba);if(a.Nr&&u===a.Ye&&w===a.Sf)return c===a.ua&&d===a.ta||a.hd(),!1;u!==a.Ye&&("1px"===da?a.ta=a.ta+a.ub:a.ta=Math.max(a.ta-a.ub,1),p=!0);a.Ye=u;m.style.width=da;w!==a.Sf&&("1px"===ba?a.ua=a.ua+a.ub:a.ua=Math.max(a.ua-a.ub,1),p=!0,a.Vn&&(q=J.alloc(),w?(b.style.left=a.ub+"px",a.position=q.h(a.ja.x+a.ub/a.scale,a.ja.y)):(b.style.left="0px",a.position=q.h(a.ja.x-a.ub/
a.scale,a.ja.y)),J.free(q)));p&&Ei(a);a.Sf=w;m.style.height=ba;a.cu=!0;p&&(a.Qn=!0);b=l.scrollLeft;a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(n+1<K?b=(a.position.x-A)*e:A+1<S?b=l.scrollWidth-l.clientWidth:y>Q+1&&(b=a.position.x*e));if(a.Vn)switch(a.Zt){case "negative":b=-(l.scrollWidth-b-l.clientWidth);break;case "reverse":b=l.scrollWidth-b-l.clientWidth}l.scrollLeft=b;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(E+1<O?l.scrollTop=(a.position.y-B)*e:B+1<H?l.scrollTop=l.scrollHeight-l.clientHeight:
v>z+1&&(l.scrollTop=a.position.y*e));u=a.ua;w=a.ta;l.style.width=u+(a.Sf?a.ub:0)+"px";l.style.height=w+(a.Ye?a.ub:0)+"px";return c!==u||d!==w||a.animationManager.tb?(c=M.allocAt(f,g,h,k),a.onViewportBoundsChanged(c,a.viewportBounds,e,p),M.free(c),!1):!0}t=R.prototype;
t.add=function(a){var b=a.diagram;if(b!==this&&(null!==b&&C("Cannot add part "+a.toString()+" to "+this.toString()+". It is already a part of "+b.toString()),b=this.Xj(a.layerName),null===b&&(b=this.Xj("")),null===b&&C('Cannot add a Part when unable find a Layer named "'+a.layerName+'" and there is no default Layer'),a.layer!==b)){var c=b.Ni(99999999,a,a.diagram===this);0<=c&&this.Wa(ie,"parts",b,null,a,null,c);b.isTemporary||this.Qa();a.B(1);c=a.layerChanged;null!==c&&c(a,null,b)}};
t.Ni=function(a){this.partManager.Ni(a);var b=this;uj(a,function(a){vj(b,a)});(a instanceof ye||a instanceof U&&null!==a.placeholder)&&a.s();null!==a.data&&uj(a,function(a){wj(b.partManager,a)});!0!==ij(a)&&!0!==jj(a)||this.te.add(a);xj(a,!0,this);yj(a)?(a.actualBounds.u()&&this.N(sj(a,a.actualBounds)),this.Qa()):a.isVisible()&&a.actualBounds.u()&&this.N(sj(a,a.actualBounds));this.Fb()};
t.ec=function(a){a.Oj();this.partManager.ec(a);var b=this;null!==a.data&&uj(a,function(a){zj(b.partManager,a,b)});this.te.remove(a);yj(a)?(a.actualBounds.u()&&this.N(sj(a,a.actualBounds)),this.Qa()):a.isVisible()&&a.actualBounds.u()&&this.N(sj(a,a.actualBounds));this.Fb()};t.remove=function(a){Aj(this,a,!0)};
function Aj(a,b,c){var d=b.layer;null!==d&&d.diagram===a&&(b.isSelected=!1,b.isHighlighted=!1,b.B(2),c&&b.Uj(),c=d.ec(-1,b,!1),0<=c&&a.Wa(pe,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.Ps=function(a,b){void 0===b&&(b=!1);if(Aa(a))for(var c=a.length,d=0;d<c;d++){var e=a[d];b&&!e.canDelete()||this.remove(e)}else for(c=new G,c.addAll(a),a=c.iterator;a.next();)c=a.value,b&&!c.canDelete()||this.remove(c)};t.Tj=function(a,b,c){void 0===c&&(c=!1);return this.partManager.Tj(a,b,c)};
R.prototype.moveParts=function(a,b,c,d){void 0===c&&(c=!1);void 0===d&&(d=Bj(this));if(null!==this.toolManager){var e=new I;if(null!==a)if(Aa(a))for(var f=0;f<a.length;f++)Cj(this,e,a[f],c,d);else for(a=a.iterator;a.next();)Cj(this,e,a.value,c,d);else{for(a=this.parts;a.next();)Cj(this,e,a.value,c,d);for(a=this.nodes;a.next();)Cj(this,e,a.value,c,d);for(a=this.links;a.next();)Cj(this,e,a.value,c,d)}jf(this,e,b,d,c)}};
function Cj(a,b,c,d,e,f){if(!b.contains(c)&&(void 0===f&&(f=!1),!d||f||c.canMove()||c.canCopy()))if(void 0===e&&(e=Bj(a)),c instanceof W){b.add(c,a.Bd(e,c,c.location));if(c instanceof U&&(null!==c.placeholder||e.dragsMembers))for(f=c.memberParts;f.next();)Cj(a,b,f.value,d,e,e.groupsAlwaysMove);for(f=c.linksConnected;f.next();){var g=f.value;if(!b.contains(g)){var h=g.fromNode,k=g.toNode;null!==h&&b.contains(h)&&null!==k&&b.contains(k)&&Cj(a,b,g,d,e)}}if(e.dragsTree)for(c=c.Ru();c.next();)Cj(a,b,c.value,
d,e)}else if(c instanceof T)for(b.add(c,a.Bd(e,c)),c=c.labelNodes;c.next();)Cj(a,b,c.value,d,e);else c instanceof ye||b.add(c,a.Bd(e,c,c.location))}
function jf(a,b,c,d,e){if(null!==b&&0!==b.count){var f=J.alloc(),g=J.alloc();g.assign(c);isNaN(g.x)&&(g.x=0);isNaN(g.y)&&(g.y=0);(c=a.Yr)||Pe(a,b);for(var h=Ga(),k=Ga(),l=b.iterator,m=J.alloc();l.next();){var n=l.key,p=l.value;if(n.Nc()){var r=Dj(a,n,b);if(null!==r)h.push(new Ej(n,p,r));else if(!e||n.canMove())r=p.point,f.assign(r),a.computeMove(n,f.add(g),d,m),n.location=m,void 0===p.shifted&&(p.shifted=new J),p.shifted.assign(m.ie(r))}else l.key instanceof T&&k.push(l.ka)}J.free(m);e=h.length;for(l=
0;l<e;l++)n=h[l],f.assign(n.info.point),void 0===n.Wu.shifted&&(n.Wu.shifted=new J),n.node.location=f.add(n.Wu.shifted);e=J.alloc();l=J.alloc();n=k.length;for(p=0;p<n;p++){var q=k[p];r=q.key;if(r instanceof T)if(r.suspendsRouting){r.gf=null;m=r.fromNode;var u=r.toNode;if(null!==a.draggedLink&&d.dragsLink)if(u=q.value.point,null===r.dragComputation)b.add(r,a.Bd(d,r,g)),gf(r,g.x-u.x,g.y-u.y);else{q=J.allocAt(0,0);(m=r.i(0))&&m.u()&&q.assign(m);var w=m=J.alloc().assign(q).add(g);d.isGridSnapEnabled&&
(d.isGridSnapRealtime||a.lastInput.up)&&(w=J.alloc(),vg(a,r,m,w,d));m.assign(r.dragComputation(r,m,w)).ie(q);b.add(r,a.Bd(d,r,m));gf(r,m.x-u.x,m.y-u.y);J.free(q);J.free(m);w!==m&&J.free(w)}else null!==m&&(e.assign(m.location),w=b.H(m),null!==w&&e.ie(w.point)),null!==u&&(l.assign(u.location),w=b.H(u),null!==w&&l.ie(w.point)),null!==m&&null!==u?e.Ua(l)?(m=q.value.point,u=f,u.assign(e),u.ie(m),b.add(r,a.Bd(d,r,e)),gf(r,u.x,u.y)):(r.suspendsRouting=!1,r.Va()):(q=q.value.point,m=null!==m?e:null!==u?l:
g,b.add(r,a.Bd(d,r,m)),gf(r,m.x-q.x,m.y-q.y))}else if(null===r.fromNode||null===r.toNode)m=q.value.point,b.add(r,a.Bd(d,r,g)),gf(r,g.x-m.x,g.y-m.y)}J.free(f);J.free(g);J.free(e);J.free(l);Ja(h);Ja(k);c||(hh(a),Ue(a,b))}}
R.prototype.computeMove=function(a,b,c,d){void 0===d&&(d=new J);d.assign(b);if(null===a)return d;var e=b,f=c.isGridSnapEnabled;f&&(c.isGridSnapRealtime||this.lastInput.up)&&(e=J.alloc(),vg(this,a,b,e,c));c=null!==a.dragComputation?a.dragComputation(a,b,e):e;var g=a.minLocation,h=g.x;isNaN(h)&&(h=f?Math.round(1E3*a.location.x)/1E3:a.location.x);g=g.y;isNaN(g)&&(g=f?Math.round(1E3*a.location.y)/1E3:a.location.y);var k=a.maxLocation,l=k.x;isNaN(l)&&(l=f?Math.round(1E3*a.location.x)/1E3:a.location.x);
k=k.y;isNaN(k)&&(k=f?Math.round(1E3*a.location.y)/1E3:a.location.y);d.h(Math.max(h,Math.min(c.x,l)),Math.max(g,Math.min(c.y,k)));e!==b&&J.free(e);return d};function Bj(a){var b=a.toolManager.findTool("Dragging");return null!==b?b.dragOptions:a.on}
function vg(a,b,c,d,e){void 0===e&&(e=Bj(a));d.assign(c);if(null!==b){var f=a.grid;b=e.gridSnapCellSize;a=b.width;b=b.height;var g=e.gridSnapOrigin,h=g.x;g=g.y;e=e.gridSnapCellSpot;if(null!==f){var k=f.gridCellSize;isNaN(a)&&(a=k.width);isNaN(b)&&(b=k.height);f=f.gridOrigin;isNaN(h)&&(h=f.x);isNaN(g)&&(g=f.y)}f=J.allocAt(0,0);f.Ui(0,0,a,b,e);L.Wp(c.x,c.y,h+f.x,g+f.y,a,b,d);J.free(f)}}function Pe(a,b){if(null!==b)for(a.Yr=!0,a=b.iterator;a.next();)b=a.key,b instanceof T&&(b.suspendsRouting=!0)}
function Ue(a,b){if(null!==b){for(b=b.iterator;b.next();){var c=b.key;c instanceof T&&(c.suspendsRouting=!1,Fj(c)&&c.Va())}a.Yr=!1}}function Dj(a,b,c){b=b.containingGroup;if(null!==b){a=Dj(a,b,c);if(null!==a)return a;a=c.H(b);if(null!==a)return a}return null}t=R.prototype;t.Bd=function(a,b,c){if(void 0===c)return new Se(qb);var d=a.isGridSnapEnabled;a.groupsSnapMembers||null===b.containingGroup||(d=!1);return d?new Se(new J(Math.round(1E3*c.x)/1E3,Math.round(1E3*c.y)/1E3)):new Se(c.copy())};
function Gj(a,b,c){null!==b.diagram&&b.diagram!==a&&C("Cannot share a Layer with another Diagram: "+b+" of "+b.diagram);null===c?null!==b.diagram&&C("Cannot add an existing Layer to this Diagram again: "+b):(c.diagram!==a&&C("Existing Layer must be in this Diagram: "+c+" not in "+c.diagram),b===c&&C("Cannot move a Layer before or after itself: "+b));if(b.diagram!==a){b=b.name;a=a.Oa;c=a.count;for(var d=0;d<c;d++)a.J(d).name===b&&C("Cannot add Layer with the name '"+b+"'; a Layer with the same name is already present in this Diagram.")}}
t.Sl=function(a){Gj(this,a,null);a.Ne(this);var b=this.Oa,c=b.count-1;if(!a.isTemporary)for(;0<=c&&b.J(c).isTemporary;)c--;b.wb(c+1,a);null!==this.Wb&&this.Wa(ie,"layers",this,null,a,null,c+1);this.N();this.Qa();return this};
t.tx=function(a,b){Gj(this,a,b);a.Ne(this);var c=this.Oa,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.Wb&&this.Wa(pe,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.J(f)===b){c.wb(f,a);break}null!==this.Wb&&this.Wa(ie,"layers",this,null,a,null,f);this.N();0>d&&this.Qa();return this};
t.Zy=function(a,b){Gj(this,a,b);a.Ne(this);var c=this.Oa,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.Wb&&this.Wa(pe,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.J(f)===b){c.wb(f+1,a);break}null!==this.Wb&&this.Wa(ie,"layers",this,null,a,null,f+1);this.N();0>d&&this.Qa();return this};
t.GA=function(a){a.diagram!==this&&C("Cannot remove a Layer from another Diagram: "+a+" of "+a.diagram);if(""!==a.name){var b=this.Oa,c=b.indexOf(a);if(b.remove(a)){for(b=a.Ha.copy().iterator;b.next();){var d=b.value,e=d.layerName;e!==a.name?d.layerName=e:d.layerName=""}null!==this.Wb&&this.Wa(pe,"layers",this,a,null,c,null);this.N();this.Qa()}}};t.Xj=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null};
t.vx=function(a){null===this.df&&(this.df=new F);this.df.add(a);this.model.yh(a);return this};t.IA=function(a){null!==this.df&&(this.df.remove(a),0===this.df.count&&(this.df=null));this.model.pk(a)};t.yh=function(a){null===this.zg&&(this.zg=new F);this.zg.add(a);return this};t.pk=function(a){null!==this.zg&&(this.zg.remove(a),0===this.zg.count&&(this.zg=null))};
t.js=function(a){this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.Yu(a);a.change!==he&&(this.isModified=!0);if(null!==this.zg)for(var b=this.zg,c=b.length,d=0;d<c;d++)b.J(d)(a)};t.Wa=function(a,b,c,d,e,f,g){void 0===f&&(f=null);void 0===g&&(g=null);var h=new fe;h.diagram=this;h.change=a;h.propertyName=b;h.object=c;h.oldValue=d;h.oldParam=f;h.newValue=e;h.newParam=g;this.js(h)};t.g=function(a,b,c,d,e){this.Wa(ge,a,this,b,c,d,e)};
R.prototype.changeState=function(a,b){if(null!==a&&a.diagram===this){var c=this.skipsModelSourceBindings;try{this.skipsModelSourceBindings=!0;var d=a.change;if(d===ge){var e=a.object;Hj(e,a.propertyName,a.H(b));if(e instanceof Y){var f=e.part;null!==f&&f.Lb()}this.isModified=!0}else if(d===ie){var g=a.object,h=a.newParam,k=a.newValue;if(g instanceof X)if("number"===typeof h&&k instanceof Y){b?g.ec(h):g.wb(h,k);var l=g.part;null!==l&&l.Lb()}else"number"===typeof h&&k instanceof Ij&&(k.isRow?Jj(g,h,
b?void 0:k):Kj(g,h,b?void 0:k));else if(g instanceof $h){var m=!0===a.oldParam;"number"===typeof h&&k instanceof V&&(b?(k.isSelected=!1,k.isHighlighted=!1,k.Lb(),g.ec(m?h:-1,k,m)):g.Ni(h,k,m))}else g instanceof R?"number"===typeof h&&k instanceof $h&&(b?this.Oa.eb(h):(k.Ne(this),this.Oa.wb(h,k))):C("unknown ChangedEvent.Insert object: "+a.toString());this.isModified=!0}else if(d===pe){var n=a.object,p=a.oldParam,r=a.oldValue;if(n instanceof X)"number"===typeof p&&r instanceof Y?b?n.wb(p,r):n.ec(p):
"number"===typeof p&&r instanceof Ij&&(r.isRow?Jj(n,p,b?r:void 0):Kj(n,p,b?r:void 0));else if(n instanceof $h){var q=!0===a.newParam;"number"===typeof p&&r instanceof V&&(b?0>n.Ha.indexOf(r)&&n.Ni(p,r,q):(r.isSelected=!1,r.isHighlighted=!1,r.Lb(),n.ec(q?p:-1,r,q)))}else n instanceof R?"number"===typeof p&&r instanceof $h&&(b?(r.Ne(this),this.Oa.wb(p,r)):this.Oa.eb(p)):C("unknown ChangedEvent.Remove object: "+a.toString());this.isModified=!0}else d!==he&&C("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings=
c}}};R.prototype.xa=function(a){return this.undoManager.xa(a)};R.prototype.Xa=function(a){return this.undoManager.Xa(a)};R.prototype.Hf=function(){return this.undoManager.Hf()};R.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.xa(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.Xa(b):this.undoManager.Hf(),this.skipsUndoManager=c}};R.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)};
R.prototype.yq=function(){this.partManager.yq()};
function Lj(a,b,c){var d=a.animationManager;if(a.qb||a.Xc)a.sa=c,Ei(a),d.tb&&d.Sd.add(d.C,"scale",b,a.sa);else if(null===a.Ca)a.sa=c,Ei(a);else{a.qb=!0;var e=a.viewportBounds.copy(),f=a.ua,g=a.ta;e.width=a.ua/b;e.height=a.ta/b;var h=a.zoomPoint.x,k=a.zoomPoint.y,l=a.contentAlignment;isNaN(h)&&(l.Oc()?l.Df(Ec)?h=0:l.Df(Fc)&&(h=f-1):h=l.hb()?l.x*(f-1):f/2);isNaN(k)&&(l.Oc()?l.Df(Dc)?k=0:l.Df(Gc)&&(k=g-1):k=l.hb()?l.y*(g-1):g/2);null===a.scaleComputation||a.animationManager.defaultAnimation.isAnimating||
(c=a.scaleComputation(a,c));c<a.minScale&&(c=a.minScale);c>a.maxScale&&(c=a.maxScale);f=J.allocAt(a.ja.x+h/b-h/c,a.ja.y+k/b-k/c);a.position=f;J.free(f);a.sa=c;Ei(a);a.onViewportBoundsChanged(e,a.viewportBounds,b,!1);a.qb=!1;Ni(a,!1);d.tb&&d.Sd.add(d.C,"scale",b,a.sa);a.N();Qi(a)}}
R.prototype.onViewportBoundsChanged=function(a,b,c,d){if(!a.A(b)){void 0===d&&(d=!1);d||Qi(this);Li(this);var e=this.layout;null===e||!e.isViewportSized||this.autoScale!==mh||d||a.width===b.width&&a.height===b.height||e.B();e=this.currentTool;!0===this.cl&&e instanceof Pa&&(this.lastInput.documentPoint=this.Xs(this.lastInput.viewPoint),Ce(e,this));this.qb||this.invalidateViewport(a,b);dj(this);this.ed.scale=c;this.ed.position.x=a.x;this.ed.position.y=a.y;this.ed.bounds.assign(a);this.ed.zx.width=
Math.round(a.width*c);this.ed.zx.height=Math.round(a.height*c);this.ed.jy.width=this.ua;this.ed.jy.height=this.ta;this.ed.by=d;this.S("ViewportBoundsChanged",this.ed,a);this.isVirtualized&&this.links.each(function(a){a.isAvoiding&&a.actualBounds.Mc(b)&&a.Va()})}};
function dj(a,b){var c=a.Yd;if(null!==c&&c.visible){for(var d=Fb.alloc(),e=1,f=1,g=c.T.m,h=g.length,k=0;k<h;k++){var l=g[k],m=Math.abs(l.interval);2>m||(Mj(l.figure)?f=f*m/L.Qx(f,m):e=e*m/L.Qx(e,m))}g=c.gridCellSize;d.h(f*g.width,e*g.height);if(void 0!==b)e=b.width,f=b.height,a=b.x,g=b.y;else{b=M.alloc();a=a.viewportBounds;b.h(a.x,a.y,a.width,a.height);if(!b.u()){M.free(b);return}e=b.width;f=b.height;a=b.x;g=b.y;M.free(b)}c.width=e+2*d.width;c.height=f+2*d.height;b=J.alloc();L.Wp(a,g,0,0,d.width,
d.height,b);b.offset(-d.width,-d.height);Fb.free(d);c.part.location=b;J.free(b)}}R.prototype.clearSelection=function(a){void 0===a&&(a=!1);var b=this.selection;if(0!==b.count){a||this.S("ChangingSelection",b);for(var c=b.ya(),d=c.length,e=0;e<d;e++)c[e].isSelected=!1;b.ea();b.clear();b.freeze();a||this.S("ChangedSelection",b)}};
R.prototype.select=function(a){null!==a&&a.diagram===this&&(!a.isSelected||1<this.selection.count)&&(this.S("ChangingSelection",this.selection),this.clearSelection(!0),a.isSelected=!0,this.S("ChangedSelection",this.selection))};
R.prototype.NA=function(a){this.S("ChangingSelection",this.selection);this.clearSelection(!0);if(Aa(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];d instanceof V||C("Diagram.selectCollection given something that is not a Part: "+d);d.isSelected=!0}else for(a=a.iterator;a.next();)b=a.value,b instanceof V||C("Diagram.selectCollection given something that is not a Part: "+b),b.isSelected=!0;this.S("ChangedSelection",this.selection)};
R.prototype.clearHighlighteds=function(){var a=this.highlighteds;if(0<a.count){for(var b=a.ya(),c=b.length,d=0;d<c;d++)b[d].isHighlighted=!1;a.ea();a.clear();a.freeze()}};t=R.prototype;t.gA=function(a){null!==a&&a.diagram===this&&(!a.isHighlighted||1<this.highlighteds.count)&&(this.clearHighlighteds(),a.isHighlighted=!0)};
t.hA=function(a){a=(new G).addAll(a);for(var b=this.highlighteds.copy().oq(a).iterator;b.next();)b.value.isHighlighted=!1;for(a=a.iterator;a.next();)b=a.value,b instanceof V||C("Diagram.highlightCollection given something that is not a Part: "+b),b.isHighlighted=!0};
t.scroll=function(a,b,c){void 0===c&&(c=1);var d="up"===b||"down"===b,e=0;if("pixel"===a)e=c;else if("line"===a)e=c*(d?this.scrollVerticalLineChange:this.scrollHorizontalLineChange);else if("page"===a)a=d?this.viewportBounds.height:this.viewportBounds.width,a*=this.scale,0!==a&&(e=c*Math.max(a-(d?this.scrollVerticalLineChange:this.scrollHorizontalLineChange),0));else{if("document"===a){e=this.documentBounds;c=this.viewportBounds;d=J.alloc();"up"===b?this.position=d.h(c.x,e.y):"left"===b?this.position=
d.h(e.x,c.y):"down"===b?this.position=d.h(c.x,e.bottom-c.height):"right"===b&&(this.position=d.h(e.right-c.width,c.y));J.free(d);return}C("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+a)}e/=this.scale;c=this.position.copy();"up"===b?c.y=this.position.y-e:"down"===b?c.y=this.position.y+e:"left"===b?c.x=this.position.x-e:"right"===b?c.x=this.position.x+e:C("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+b);this.position=c};
t.Fv=function(a){var b=this.viewportBounds;b.Ge(a)||(a=a.center,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};t.ks=function(a){var b=this.viewportBounds;a=a.center;a.x-=b.width/2;a.y-=b.height/2;this.position=a};t.vq=function(a){var b=this.vb;b.reset();1!==this.sa&&b.scale(this.sa);var c=this.ja;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return a.copy().transform(this.vb)};
t.WA=function(a){var b=this.vb,c=a.x,d=a.y,e=c+a.width,f=d+a.height,g=b.m11,h=b.m12,k=b.m21,l=b.m22,m=b.dx,n=b.dy,p=c*g+d*k+m;b=c*h+d*l+n;var r=e*g+d*k+m;a=e*h+d*l+n;d=c*g+f*k+m;c=c*h+f*l+n;g=e*g+f*k+m;e=e*h+f*l+n;f=Math.min(p,r);p=Math.max(p,r);r=Math.min(b,a);b=Math.max(b,a);f=Math.min(f,d);p=Math.max(p,d);r=Math.min(r,c);b=Math.max(b,c);f=Math.min(f,g);p=Math.max(p,g);r=Math.min(r,e);b=Math.max(b,e);return new M(f,r,p-f,b-r)};
t.Xs=function(a){var b=this.vb;b.reset();1!==this.sa&&b.scale(this.sa);var c=this.ja;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return yb(a.copy(),this.vb)};function Nj(a){var b=a.isModified;a.px!==b&&(a.px=b,a.S("Modified"))}function Oj(a){a=hi.get(a);return null!==a?new a:new ii}
R.prototype.doModelChanged=function(a){var b=this;if(a.model===this.model){var c=a.change,d=a.propertyName;if(c===he&&"S"===d[0])if("StartingFirstTransaction"===d){var e=this;a=this.toolManager;a.mouseDownTools.each(function(a){a.diagram=e});a.mouseMoveTools.each(function(a){a.diagram=e});a.mouseUpTools.each(function(a){a.diagram=e});this.Xc||this.Uf||(this.Qk=!0,this.zn&&(this.jg=!0))}else"StartingUndo"===d||"StartingRedo"===d?(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&
a.qc(),this.S("ChangingSelection",this.selection)):"StartedTransaction"===d&&(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&a.qc());else if(this.Z){this.Z=!1;try{if(""===a.modelChange&&c===he){if("FinishedUndo"===d||"FinishedRedo"===d)this.S("ChangedSelection",this.selection),hh(this);var f=this.animationManager;"RolledBackTransaction"===d&&f.qc();this.Qk=!0;this.hd();0!==this.undoManager.transactionLevel&&1!==this.undoManager.transactionLevel||ih(f);"CommittedTransaction"===
d&&this.undoManager.isJustDiscarded&&(this.se=Math.min(this.se,this.undoManager.historyIndex-1));"CommittedTransaction"!==d&&"RolledBackTransaction"!==d||!this.undoManager.isPendingUnmodified||setTimeout(function(){b.isModified=!1},1);var g=a.isTransactionFinished;g&&(Nj(this),this.Gs.clear(),Gh(this.animationManager));if(!this.St&&g&&this.lastInput.targetDiagram){this.St=!0;var h=this;ua(function(){h.currentTool.standardMouseOver();h.St=!1},10)}}}finally{this.Z=!0}}}};
function vj(a,b){b=b.T.m;for(var c=b.length,d=0;d<c;d++)Pj(a,b[d])}function Pj(a,b){if(b instanceof Qj){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){c.Hg instanceof G&&c.Hg.add(a);var d=b.Lg;null!==d&&!0===d.lr&&null!==b.diagram&&b.diagram.Oo.add(b);if(c.En)if(c=c.getAttribute("src")||"",d=a.eh.H(c),null===d)d=[],d.push(b),a.eh.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}}
function Rj(a,b){if(b instanceof Qj){var c=b.element;if(null!==c&&c instanceof HTMLImageElement&&(c.Hg instanceof G&&c.Hg.remove(a),Sj(c),c.En)){c=c.getAttribute("src")||"";var d=a.eh.H(c);if(null!==d)for(var e=0;e<d.length;e++)if(d[e]===b){d.splice(e,1);0===d.length&&(a.eh.remove(c),Di(c));break}}}}R.prototype.Ld=function(){this.partManager.Ld()};R.prototype.Kj=function(a,b){this.Pd.Kj(a,b)};R.prototype.Mj=function(a,b){this.Pd.Mj(a,b)};R.prototype.findPartForKey=function(a){return this.partManager.findPartForKey(a)};
R.prototype.Eb=function(a){return this.partManager.Eb(a)};R.prototype.findLinkForKey=function(a){return this.partManager.findLinkForKey(a)};t=R.prototype;t.zc=function(a){return this.partManager.zc(a)};t.Gi=function(a){return this.partManager.Gi(a)};t.yc=function(a){return this.partManager.yc(a)};t.qs=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.qs.apply(this.partManager,b instanceof Array?b:ea(ca(b)))};
t.ps=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.ps.apply(this.partManager,b instanceof Array?b:ea(ca(b)))};function Ei(a){var b=a.ja,c=a.sa;a.ox.h(b.x,b.y,Math.max(a.ua,0)/c,Math.max(a.ta,0)/c)}function qj(a,b){a.jj=!1;var c=a.Tq;c.A(b)||(c=c.copy(),a.Tq.assign(b),Ni(a,!1),a.S("DocumentBoundsChanged",void 0,c),Qi(a))}t.Ta=function(){if(this.jj){var a=M.alloc();qj(this,this.computeBounds(a));M.free(a)}};
t.Qz=function(){for(var a=new G,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&a.add(c)}for(b=this.links;b.next();)c=b.value,c.isTopLevel&&a.add(c);return a.iterator};t.Pz=function(){return this.wi.iterator};t.qA=function(a){hh(this);a&&Tj(this,!0);this.Xc?ej(this,!1):(this.Qk=!0,uf(this))};function Tj(a,b){for(var c=a.wi.iterator;c.next();)Uj(a,c.value,b);a.layout&&(b?a.layout.isValidLayout=!1:a.layout.B())}
function Uj(a,b,c){if(null!==b){for(var d=b.pl.iterator;d.next();)Uj(a,d.value,c);null!==b.layout&&(c?b.layout.isValidLayout=!1:b.layout.B())}}
function ej(a,b){if(a.Oh&&!a.xt){var c=a.Z;a.Z=!0;var d=a.undoManager.transactionLevel,e=a.layout,f=a.animationManager;try{0===d&&(a.undoManager.isInternalTransaction=!0,a.xa("Layout"));1>=d&&!f.defaultAnimation.isAnimating&&!f.tb&&(b||gh(f,"Layout"));a.Oh=!1;for(var g=a.wi.iterator;g.next();)Vj(a,g.value,b,d);e.isValidLayout||(!b||e.isRealtime||null===e.isRealtime||0===d?(e.doLayout(a),hh(a),e.isValidLayout=!0):a.Oh=!0)}finally{b=a.undoManager.isInternalTransaction,0===d&&(a.Xa("Layout"),a.undoManager.isInternalTransaction=
!1),!b||0!==d&&1!==d||ih(f),a.Z=c}}}function Vj(a,b,c,d){if(null!==b){for(var e=b.pl.iterator;e.next();)Vj(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.Jh=!b.location.u(),e.doLayout(b),b.B(32),gj(a,b),e.isValidLayout=!0):a.Oh=!0)}}t.Wz=function(){for(var a=new F,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.Ii()&&a.add(c)}return a.iterator};
function qi(a){function b(a){var b=a.toLowerCase(),e=new F;c.add(a,e);c.add(b,e);d.add(a,a);d.add(b,a)}var c=new I,d=new I;b("InitialAnimationStarting");b("AnimationStarting");b("AnimationFinished");b("BackgroundSingleClicked");b("BackgroundDoubleClicked");b("BackgroundContextClicked");b("ClipboardChanged");b("ClipboardPasted");b("DocumentBoundsChanged");b("ExternalObjectsDropped");b("GainedFocus");b("InitialLayoutCompleted");b("LayoutCompleted");b("LinkDrawn");b("LinkRelinked");b("LinkReshaped");
b("LostFocus");b("Modified");b("ObjectSingleClicked");b("ObjectDoubleClicked");b("ObjectContextClicked");b("PartCreated");b("PartResized");b("PartRotated");b("SelectionMoved");b("SelectionCopied");b("SelectionDeleting");b("SelectionDeleted");b("SelectionGrouped");b("SelectionUngrouped");b("ChangingSelection");b("ChangedSelection");b("SubGraphCollapsed");b("SubGraphExpanded");b("TextEdited");b("TreeCollapsed");b("TreeExpanded");b("ViewportBoundsChanged");b("InvalidateDraw");a.Hw=c;a.Gw=d}
function pj(a,b){var c=a.Gw.H(b);return null!==c?c:a.Gw.H(b.toLowerCase())}function dk(a,b){var c=a.Hw.H(b);if(null!==c)return c;c=a.Hw.H(b.toLowerCase());if(null!==c)return c;C("Unknown DiagramEvent name: "+b)}t.Lj=function(a,b){a=dk(this,a);null!==a&&a.add(b);return this};t.km=function(a,b){a=dk(this,a);null!==a&&a.remove(b)};
t.S=function(a,b,c){var d=dk(this,a),e=new ee;e.diagram=this;a=pj(this,a);null!==a&&(e.name=a);void 0!==b&&(e.subject=b);void 0!==c&&(e.parameter=c);b=d.length;if(1===b)d.J(0)(e);else if(0!==b)for(d=d.ya(),c=0;c<b;c++)(0,d[c])(e)};function hk(a){if(a.animationManager.isTicking)return!1;var b=a.currentTool;return b===a.toolManager.findTool("Dragging")?!a.Yr||b.isComplexRoutingRealtime:!0}t.dk=function(a,b){return ik(this,!1,null,b||null).dk(a.x,a.y,a.width,a.height)};
R.prototype.computeOccupiedArea=function(a){return this.isVirtualized?this.viewportBounds.copy():this.jj?Mi(this,a):a.assign(this.documentBounds)};
function ik(a,b,c,d){null===a.$c&&(a.$c=new jk);if(a.$c.zs||a.$c.group!==c||a.$c.yy!==d){null!==c&&(c=kk(a,c));if(null===c){b=M.alloc();a.computeOccupiedArea(b);b.Kc(100,100);a.$c.initialize(b);for(var e=a.nodes;e.next();){var f=e.value,g=f.layer;null!==g&&g.visible&&!g.isTemporary&&lk(a,f,d,b)}M.free(b)}else{0<c.memberParts.count&&(b=a.computePartsBounds(c.memberParts,!1),b.Kc(20,20),a.$c.initialize(b));b=M.alloc();for(e=c.memberParts;e.next();)f=e.value,f instanceof W&&lk(a,f,d,b);M.free(b)}a.$c.group=
c;a.$c.yy=d;a.$c.zs=!1}else b&&mk(a.$c);return a.$c}function kk(a,b){return b.avoidable&&!b.isLinkLabel?b:null!==b.containingGroup?kk(a,b.containingGroup):null}
function lk(a,b,c,d){if(b!==c&&b.isVisible())if(b.avoidable&&!b.isLinkLabel){b=b.getAvoidableRect(d);a=a.$c;var e=b.x,f=b.y;if(nk(a,e,f))for(c=(f-a.Ad)/a.hc|0,d=Math.min((e+b.width-a.zd)/a.gc|0,a.yi),b=Math.min((f+b.height-a.Ad)/a.hc|0,a.zi),e=(e-a.zd)/a.gc|0;e<=d;e++)if(f=a.Tb[e],f.fill)f.fill(ok,c,b+1);else for(var g=c;g<=b;g++)f[g]=ok}else if(b instanceof U)for(b=b.memberParts;b.next();)e=b.value,e instanceof W&&lk(a,e,c,d)}
function pk(a,b){null===a.$c||a.$c.zs||void 0!==b&&(!b.avoidable||b.isLinkLabel)||(a.$c.zs=!0)}R.prototype.ms=function(a){this.Cq.assign(a);this.computeAutoScrollPosition(this.Cq).Ua(this.position)?this.tg():qk(this)};
function qk(a){-1===a.zk&&(a.zk=ua(function(){if(-1!==a.zk&&(a.tg(),null!==a.lastInput.event)){var b=a.computeAutoScrollPosition(a.Cq);b.Ua(a.position)||(a.position=b,a.lastInput.documentPoint=a.Xs(a.Cq),a.doMouseMove(),a.jj=!0,b=M.alloc(),a.computeBounds(b),b.Rc(a.documentBounds),qj(a,b),M.free(b),a.Wc=!0,a.hd(),qk(a))}},a.Bq))}R.prototype.tg=function(){-1!==this.zk&&(x.clearTimeout(this.zk),this.zk=-1)};
R.prototype.computeAutoScrollPosition=function(a){var b=this.position,c=this.Dq;if(0>=c.top&&0>=c.left&&0>=c.right&&0>=c.bottom)return b;var d=this.viewportBounds,e=this.scale;d=M.allocAt(0,0,d.width*e,d.height*e);var f=J.allocAt(0,0);if(a.x>=d.x&&a.x<d.x+c.left&&this.allowHorizontalScroll){var g=Math.max(this.scrollHorizontalLineChange,1);g|=0;f.x-=g;a.x<d.x+c.left/2&&(f.x-=g);a.x<d.x+c.left/4&&(f.x-=4*g)}else a.x<=d.x+d.width&&a.x>d.x+d.width-c.right&&this.allowHorizontalScroll&&(g=Math.max(this.scrollHorizontalLineChange,
1),g|=0,f.x+=g,a.x>d.x+d.width-c.right/2&&(f.x+=g),a.x>d.x+d.width-c.right/4&&(f.x+=4*g));a.y>=d.y&&a.y<d.y+c.top&&this.allowVerticalScroll?(g=Math.max(this.scrollVerticalLineChange,1),g|=0,f.y-=g,a.y<d.y+c.top/2&&(f.y-=g),a.y<d.y+c.top/4&&(f.y-=4*g)):a.y<=d.y+d.height&&a.y>d.y+d.height-c.bottom&&this.allowVerticalScroll&&(g=Math.max(this.scrollVerticalLineChange,1),g|=0,f.y+=g,a.y>d.y+d.height-c.bottom/2&&(f.y+=g),a.y>d.y+d.height-c.bottom/4&&(f.y+=4*g));f.Ua(qb)||(b=new J(b.x+f.x/e,b.y+f.y/e));
M.free(d);J.free(f);return b};t=R.prototype;t.Is=function(){return null};t.kv=function(){return null};t.cz=function(a,b){this.Qy.add(a,b)};t.zu=function(a){(this.mx=a)||this.nodes.each(function(a){a instanceof U&&(a.Zq=null)})};
function rk(a,b,c){function d(){var a=+new Date;f=!0;for(g.reset();g.next();)if(!g.value[0].kl){f=!1;break}f||a-l>k?b(c,e,h):x.requestAnimationFrame(d)}for(var e=c.callback,f=!0,g=a.eh.iterator;g.next();)if(!g.value[0].kl){f=!1;break}if("function"!==typeof e||f)return b(c,e,a);var h=a,k=c.callbackTimeout||300,l=+new Date;x.requestAnimationFrame(function(){d()});return null}t.sA=function(a){if(!Jg)return null;void 0===a&&(a={});a.returnType="Image";return this.gy(a)};
t.gy=function(a){void 0===a&&(a={});return rk(this,this.tA,a)};
t.tA=function(a,b,c){var d=sk(c,a,"canvas",null);if(null===d)return null;c=d.Y.canvas;var e=null;if(null!==c)switch(e=a.returnType,void 0===e?e="string":e=e.toLowerCase(),e){case tk+"data":e=d.getImageData(0,0,c.width,c.height);break;case tk:d=(a.document||document).createElement("img");d.src=c.toDataURL(a.type,a.details);e=d;break;case "blob":"function"!==typeof b&&C('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.');if("function"===
typeof c.toBlob)return c.toBlob(b,a.type,a.details),"toBlob";if("function"===typeof c.msToBlob)return b(c.msToBlob()),"msToBlob";b(null);return null;default:e=c.toDataURL(a.type,a.details)}return"function"===typeof b?(b(e),null):e};
function sk(a,b,c,d){a.animationManager.qc();a.hd();if(null===a.Ca)return null;"object"!==typeof b&&C("properties argument must be an Object.");var e=b.size||null,f=b.scale||null;void 0!==b.scale&&isNaN(b.scale)&&(f="NaN");var g=b.maxSize;void 0===b.maxSize&&(g="SVG"===c?new Fb(Infinity,Infinity):new Fb(2E3,2E3));var h=b.position||null,k=b.parts||null,l=void 0===b.padding?1:b.padding,m=b.background||null,n=b.omitTemporary;void 0===n&&(n=!0);var p=b.document||document,r=b.elementFinished||null,q=b.showTemporary;
void 0===q&&(q=!n);b=b.showGrid;void 0===b&&(b=q);null!==e&&isNaN(e.width)&&isNaN(e.height)&&(e=null);"number"===typeof l?l=new kc(l):l instanceof kc||C("MakeImage padding must be a Margin or a number.");l.left=Math.max(l.left,0);l.right=Math.max(l.right,0);l.top=Math.max(l.top,0);l.bottom=Math.max(l.bottom,0);a.Vb.Ic(!0);n=new uk(null,p);var u=n.context;if(!(e||f||k||h)){n.width=a.ua+Math.ceil(l.left+l.right);n.height=a.ta+Math.ceil(l.top+l.bottom);if("SVG"===c){if(null===d)return null;d.resize(n.width,
n.height,n.width,n.height);d.ownerDocument=p;d.Tp=r;nj(a,d.context,l,new Fb(n.width,n.height),a.sa,a.ja,k,m,q,b);return d.context}a.qn=!1;nj(a,u,l,new Fb(n.width,n.height),a.sa,a.ja,k,m,q,b);a.qn=!0;return n.context}var w=a.Rq,v=a.documentBounds.copy();v.Nv(a.nb);if(q)for(var A=a.Oa.m,y=A.length,B=0;B<y;B++){var z=A[B];if(z.visible&&z.isTemporary){z=z.Ha.m;for(var E=z.length,K=0;K<E;K++){var O=z[K];O.isInDocumentBounds&&O.isVisible()&&(O=O.actualBounds,O.u()&&v.Rc(O))}}}A=new J(v.x,v.y);if(null!==
k){y=new M(0,0,0,0);B=!0;z=k.iterator;for(z.reset();z.next();)E=z.value,E instanceof V&&(K=E.layer,null!==K&&!K.visible||null!==K&&!q&&K.isTemporary||!E.isVisible()||(E=E.actualBounds,E.u()&&(B?(B=!1,y.assign(E)):y.Rc(E))));v.width=y.width;v.height=y.height;A.x=y.x;A.y=y.y}null!==h&&h.u()&&(A=h,f||(f=w));y=h=0;null!==l&&(h=l.left+l.right,y=l.top+l.bottom);B=z=0;null!==e&&(z=e.width,B=e.height,isFinite(z)&&(z=Math.max(0,z-h)),isFinite(B)&&(B=Math.max(0,B-y)));null!==e&&null!==f?("NaN"===f&&(f=w),e.u()?
(e=z,v=B):isNaN(B)?(e=z,v=v.height*f):(e=v.width*f,v=B)):null!==e?e.u()?(f=Math.min(z/v.width,B/v.height),e=z,v=B):isNaN(B)?(f=z/v.width,e=z,v=v.height*f):(f=B/v.height,e=v.width*f,v=B):null!==f?"NaN"===f&&g.u()?(f=Math.min((g.width-h)/v.width,(g.height-y)/v.height),f>w?(f=w,e=v.width,v=v.height):(e=g.width,v=g.height)):(e=v.width*f,v=v.height*f):(f=w,e=v.width,v=v.height);null!==l?(e+=h,v+=y):l=new kc(0);null!==g&&(w=g.width,g=g.height,isNaN(w)&&(w=2E3),isNaN(g)&&(g=2E3),isFinite(w)&&(e=Math.min(e,
w)),isFinite(g)&&(v=Math.min(v,g)));n.width=Math.ceil(e);n.height=Math.ceil(v);if("SVG"===c){if(null===d)return null;d.resize(n.width,n.height,n.width,n.height);d.ownerDocument=p;d.Tp=r;nj(a,d.context,l,new Fb(Math.ceil(e),Math.ceil(v)),f,A,k,m,q,b);return d.context}a.qn=!1;nj(a,u,l,new Fb(Math.ceil(e),Math.ceil(v)),f,A,k,m,q,b);a.qn=!0;return n.context}
na.Object.defineProperties(R.prototype,{div:{get:function(){return this.Ga},set:function(a){if(this.Ga!==a){var b=this.Ga;null!==b?(b.C=void 0,b.goDiagram=void 0,b.go=void 0,b.innerHTML="",null!==this.Ca&&(b=this.Ca.La,this.removeEventListener(b,"pointermove",this.kk,!1),this.removeEventListener(b,"pointerdown",this.jk,!1),this.removeEventListener(b,"pointerup",this.mk,!1),this.removeEventListener(b,"pointerout",this.lk,!1),this.Ca.Ix()),this.xl&&(this.xl.disconnect(),
this.xl=null),b=this.toolManager,null!==b&&(b.mouseDownTools.each(function(a){a.cancelWaitAfter()}),b.mouseMoveTools.each(function(a){a.cancelWaitAfter()}),b.mouseUpTools.each(function(a){a.cancelWaitAfter()})),b.cancelWaitAfter(),this.currentTool.doCancel(),this.Ca=null,this.removeEventListener(x,"resize",this.Zv,!1),this.removeEventListener(x,"wheel",this.gk,!0),ue===this&&(ue=null)):this.Uf=!1;this.Ga=null;if(null!==a){if(b=a.C)b.div=null;oi(this,a);this.redraw()}}}},xx:{
get:function(){return this.zr}},Oi:{get:function(){return this.Uf}},draggedLink:{get:function(){return this.ru},set:function(a){this.ru!==a&&(this.ru=a,null!==a&&(this.Sv=a.fromPort,this.Yv=a.toPort))}},ky:{get:function(){return this.Sv},set:function(a){this.Sv=a}},ly:{get:function(){return this.Yv},set:function(a){this.Yv=a}},animationManager:{get:function(){return this.Pd}},
undoManager:{get:function(){return this.Wb.undoManager}},skipsUndoManager:{get:function(){return this.kh},set:function(a){this.kh=a;this.Wb.skipsUndoManager=a}},delaysLayout:{get:function(){return this.xt},set:function(a){this.xt=a}},opacity:{get:function(){return this.mb},set:function(a){var b=this.mb;b!==a&&((0>a||1<a)&&xa(a,"0 <= value <= 1",R,"opacity"),this.mb=a,this.g("opacity",
b,a),this.N())}},validCycle:{get:function(){return this.dt},set:function(a){var b=this.dt;b!==a&&(this.dt=a,this.g("validCycle",b,a))}},layers:{get:function(){return this.Oa.iterator}},isModelReadOnly:{get:function(){var a=this.Wb;return null===a?!1:a.isReadOnly},set:function(a){var b=this.Wb;null!==b&&(b.isReadOnly=a)}},isReadOnly:{get:function(){return this.Rg},set:function(a){var b=
this.Rg;b!==a&&(this.Rg=a,this.g("isReadOnly",b,a))}},isEnabled:{get:function(){return this.wd},set:function(a){var b=this.wd;b!==a&&(this.wd=a,this.g("isEnabled",b,a))}},allowClipboard:{get:function(){return this.rk},set:function(a){var b=this.rk;b!==a&&(this.rk=a,this.g("allowClipboard",b,a))}},allowCopy:{get:function(){return this.D},set:function(a){var b=this.D;b!==a&&(this.D=a,this.g("allowCopy",b,a))}},
allowDelete:{get:function(){return this.L},set:function(a){var b=this.L;b!==a&&(this.L=a,this.g("allowDelete",b,a))}},allowDragOut:{get:function(){return this.sk},set:function(a){var b=this.sk;b!==a&&(this.sk=a,this.g("allowDragOut",b,a))}},allowDrop:{get:function(){return this.Im},set:function(a){var b=this.Im;b!==a&&(this.Im=a,this.g("allowDrop",b,a))}},allowTextEdit:{get:function(){return this.Od},
set:function(a){var b=this.Od;b!==a&&(this.Od=a,this.g("allowTextEdit",b,a))}},allowGroup:{get:function(){return this.wa},set:function(a){var b=this.wa;b!==a&&(this.wa=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.ke},set:function(a){var b=this.ke;b!==a&&(this.ke=a,this.g("allowUngroup",b,a))}},allowInsert:{get:function(){return this.jt},set:function(a){var b=this.jt;b!==a&&(this.jt=
a,this.g("allowInsert",b,a))}},allowLink:{get:function(){return this.Ba},set:function(a){var b=this.Ba;b!==a&&(this.Ba=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.Qb},set:function(a){var b=this.Qb;b!==a&&(this.Qb=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.Ma},set:function(a){var b=this.Ma;b!==a&&(this.Ma=a,this.g("allowMove",b,a))}},allowReshape:{
get:function(){return this.Gb},set:function(a){var b=this.Gb;b!==a&&(this.Gb=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.Rb},set:function(a){var b=this.Rb;b!==a&&(this.Rb=a,this.g("allowResize",b,a))}},allowRotate:{get:function(){return this.rc},set:function(a){var b=this.rc;b!==a&&(this.rc=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.Nd},set:function(a){var b=
this.Nd;b!==a&&(this.Nd=a,this.g("allowSelect",b,a))}},allowUndo:{get:function(){return this.kt},set:function(a){var b=this.kt;b!==a&&(this.kt=a,this.g("allowUndo",b,a))}},allowZoom:{get:function(){return this.nt},set:function(a){var b=this.nt;b!==a&&(this.nt=a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{get:function(){return this.Nn},set:function(a){var b=this.Nn;b!==a&&(this.Nn=a,Qi(this),this.N(),this.g("hasVerticalScrollbar",
b,a),Ni(this,!1))}},hasHorizontalScrollbar:{get:function(){return this.Mn},set:function(a){var b=this.Mn;b!==a&&(this.Mn=a,Qi(this),this.N(),this.g("hasHorizontalScrollbar",b,a),Ni(this,!1))}},allowHorizontalScroll:{get:function(){return this.it},set:function(a){var b=this.it;b!==a&&(this.it=a,this.g("allowHorizontalScroll",b,a),Ni(this,!1))}},allowVerticalScroll:{get:function(){return this.mt},set:function(a){var b=
this.mt;b!==a&&(this.mt=a,this.g("allowVerticalScroll",b,a),Ni(this,!1))}},scrollHorizontalLineChange:{get:function(){return this.Zs},set:function(a){var b=this.Zs;b!==a&&(0>a&&xa(a,">= 0",R,"scrollHorizontalLineChange"),this.Zs=a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{get:function(){return this.$s},set:function(a){var b=this.$s;b!==a&&(0>a&&xa(a,">= 0",R,"scrollVerticalLineChange"),this.$s=a,this.g("scrollVerticalLineChange",
b,a))}},lastInput:{get:function(){return this.rj},set:function(a){this.rj=a}},previousInput:{get:function(){return this.gh},set:function(a){this.gh=a}},firstInput:{get:function(){return this.br},set:function(a){this.br=a}},currentCursor:{get:function(){return this.Ys},set:function(a){""===a&&(a=this.Zi);if(this.Ys!==a){var b=this.Ca,c=this.Ga;if(null!==b&&null!==c){this.Ys=a;var d=
b.style.cursor;b.style.cursor=a;c.style.cursor=a;b.style.cursor===d&&(b.style.cursor="-webkit-"+a,c.style.cursor="-webkit-"+a,b.style.cursor===d&&(b.style.cursor="-moz-"+a,c.style.cursor="-moz-"+a,b.style.cursor===d&&(b.style.cursor=a,c.style.cursor=a)))}}}},defaultCursor:{get:function(){return this.Zi},set:function(a){""===a&&(a="auto");var b=this.Zi;b!==a&&(this.Zi=a,this.g("defaultCursor",b,a))}},click:{get:function(){return this.Ag},
set:function(a){var b=this.Ag;b!==a&&(this.Ag=a,this.g("click",b,a))}},doubleClick:{get:function(){return this.Ig},set:function(a){var b=this.Ig;b!==a&&(this.Ig=a,this.g("doubleClick",b,a))}},contextClick:{get:function(){return this.Cg},set:function(a){var b=this.Cg;b!==a&&(this.Cg=a,this.g("contextClick",b,a))}},mouseOver:{get:function(){return this.ah},set:function(a){var b=this.ah;b!==a&&(this.ah=a,this.g("mouseOver",
b,a))}},mouseHover:{get:function(){return this.Zg},set:function(a){var b=this.Zg;b!==a&&(this.Zg=a,this.g("mouseHover",b,a))}},mouseHold:{get:function(){return this.Yg},set:function(a){var b=this.Yg;b!==a&&(this.Yg=a,this.g("mouseHold",b,a))}},mouseDragOver:{get:function(){return this.vv},set:function(a){var b=this.vv;b!==a&&(this.vv=a,this.g("mouseDragOver",b,a))}},mouseDrop:{get:function(){return this.Wg},
set:function(a){var b=this.Wg;b!==a&&(this.Wg=a,this.g("mouseDrop",b,a))}},handlesDragDropForTopLevelParts:{get:function(){return this.Su},set:function(a){var b=this.Su;b!==a&&(this.Su=a,this.g("handlesDragDropForTopLevelParts",b,a))}},mouseEnter:{get:function(){return this.Xg},set:function(a){var b=this.Xg;b!==a&&(this.Xg=a,this.g("mouseEnter",b,a))}},mouseLeave:{get:function(){return this.$g},set:function(a){var b=
this.$g;b!==a&&(this.$g=a,this.g("mouseLeave",b,a))}},toolTip:{get:function(){return this.uh},set:function(a){var b=this.uh;b!==a&&(this.uh=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return this.Dg},set:function(a){var b=this.Dg;b!==a&&(this.Dg=a,this.g("contextMenu",b,a))}},commandHandler:{get:function(){return this.gw},set:function(a){this.gw!==a&&(this.gw=a,a.Ne(this))}},toolManager:{
get:function(){return this.qw},set:function(a){this.qw!==a&&(this.qw=a,a.diagram=this)}},defaultTool:{get:function(){return this.iw},set:function(a){var b=this.iw;b!==a&&(this.iw=a,a.diagram=this,this.currentTool===b&&(this.currentTool=a))}},currentTool:{get:function(){return this.hw},set:function(a){var b=this.hw;b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&(this.hw=
a,a.diagram=this,a.doStart())}},selection:{get:function(){return this.ex}},maxSelectionCount:{get:function(){return this.rv},set:function(a){var b=this.rv;if(b!==a)if(0<=a&&!isNaN(a)){if(this.rv=a,this.g("maxSelectionCount",b,a),!this.undoManager.isUndoingRedoing&&(a=this.selection.count-a,0<a)){this.S("ChangingSelection",this.selection);b=this.selection.ya();for(var c=0;c<a;c++)b[c].isSelected=!1;this.S("ChangedSelection",this.selection)}}else xa(a,
">= 0",R,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{get:function(){return this.Dv},set:function(a){var b=this.Dv;b!==a&&(this.Dv=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{get:function(){return this.Ku},set:function(a){var b=this.Ku;b!==a&&(this.Ku=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{get:function(){return this.mv},
set:function(a){var b=this.mv;b!==a&&(this.mv=a,this.g("linkSelectionAdornmentTemplate",b,a))}},highlighteds:{get:function(){return this.Nw}},isModified:{get:function(){var a=this.undoManager;return a.isEnabled?null!==a.currentTransaction?!0:this.Tn&&this.se!==a.historyIndex:this.Tn},set:function(a){if(this.Tn!==a){this.Tn=a;var b=this.undoManager;!a&&b.isEnabled&&(this.se=b.historyIndex);a||Nj(this)}}},model:{
get:function(){return this.Wb},set:function(a){var b=this.Wb;if(b!==a){this.currentTool.doCancel();b&&b.undoManager!==a.undoManager&&b.undoManager.isInTransaction&&C("Do not replace a Diagram.model while a transaction is in progress.");this.animationManager.qc(!0);var c=Ci(this,!0);this.Uf=!1;this.zn=!0;this.se=-2;this.jg=!1;var d=this.qb;this.qb=!0;gh(this.animationManager,"Model");b&&(null!==this.df&&this.df.each(function(a){b.pk(a)}),b.pk(this.nw));this.Wb=a;this.partManager=Oj(this.Wb.type);for(var e=
0;e<c.length;e++)this.add(c[e]);a.yh(this.mw);this.partManager.addAllModeledParts();a.pk(this.mw);a.yh(this.nw);null!==this.df&&this.df.each(function(b){a.yh(b)});this.qb=d;this.Qa();this.qb||this.N();b&&a.undoManager.copyProperties(b.undoManager)}}},Z:{get:function(){return this.lw},set:function(a){this.lw=a}},Gs:{get:function(){return this.Gy}},skipsModelSourceBindings:{get:function(){return this.pw},set:function(a){this.pw=
a}},Vs:{get:function(){return this.hu},set:function(a){this.hu=a}},nodeTemplate:{get:function(){return this.j.H("")},set:function(a){var b=this.j.H("");b!==a&&(this.j.add("",a),this.g("nodeTemplate",b,a),this.undoManager.isUndoingRedoing||this.Ld())}},nodeTemplateMap:{get:function(){return this.j},set:function(a){var b=this.j;b!==a&&(this.j=a,this.g("nodeTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Ld())}},
groupTemplate:{get:function(){return this.Cc.H("")},set:function(a){var b=this.Cc.H("");b!==a&&(this.Cc.add("",a),this.g("groupTemplate",b,a),this.undoManager.isUndoingRedoing||this.Ld())}},groupTemplateMap:{get:function(){return this.Cc},set:function(a){var b=this.Cc;b!==a&&(this.Cc=a,this.g("groupTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Ld())}},linkTemplate:{get:function(){return this.o.H("")},
set:function(a){var b=this.o.H("");b!==a&&(this.o.add("",a),this.g("linkTemplate",b,a),this.undoManager.isUndoingRedoing||this.Ld())}},linkTemplateMap:{get:function(){return this.o},set:function(a){var b=this.o;b!==a&&(this.o=a,this.g("linkTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Ld())}},isMouseCaptured:{get:function(){return this.kw},set:function(a){var b=this.Ca;null!==b&&(b=b.La,b instanceof SVGElement||(a?(this.lastInput.bubbles=
!1,this.removeEventListener(b,"pointermove",this.kk,!1),this.removeEventListener(b,"pointerdown",this.jk,!1),this.removeEventListener(b,"pointerup",this.mk,!1),this.removeEventListener(b,"pointerout",this.lk,!1),this.addEventListener(x,"pointermove",this.kk,!0),this.addEventListener(x,"pointerdown",this.jk,!0),this.addEventListener(x,"pointerup",this.mk,!0),this.addEventListener(x,"pointerout",this.lk,!0),this.removeEventListener(b,"wheel",this.gk,!1),this.addEventListener(x,"wheel",this.gk,!0),this.addEventListener(x,
"selectstart",this.preventDefault,!1)):(this.removeEventListener(x,"pointermove",this.kk,!0),this.removeEventListener(x,"pointerdown",this.jk,!0),this.removeEventListener(x,"pointerup",this.mk,!0),this.removeEventListener(x,"pointerout",this.lk,!0),this.addEventListener(b,"pointermove",this.kk,!1),this.addEventListener(b,"pointerdown",this.jk,!1),this.addEventListener(b,"pointerup",this.mk,!1),this.addEventListener(b,"pointerout",this.lk,!1),this.removeEventListener(x,"wheel",this.gk,!0),this.removeEventListener(x,
"selectstart",this.preventDefault,!1),this.addEventListener(b,"wheel",this.gk,!1)),this.kw=a))}},position:{get:function(){return this.ja},set:function(a){var b=J.alloc().assign(this.ja);if(!b.A(a)){var c=this.viewportBounds.copy();this.ja.assign(a);Jh(this.animationManager,b,this.ja);this.qb||null===this.Ca&&!this.Fp.u()?Ei(this):(this.qb=!0,a=this.scale,Pi(this,this.Tq,this.ua/a,this.ta/a,this.Gk,!1),this.qb=!1);if(!this.qb)this.onViewportBoundsChanged(c,this.viewportBounds,
this.sa,!1)}J.free(b)}},initialPosition:{get:function(){return this.Zu},set:function(a){this.Zu.A(a)||(this.Zu=a.I())}},initialScale:{get:function(){return this.fv},set:function(a){this.fv!==a&&(this.fv=a)}},grid:{get:function(){null===this.Yd&&(this.Yd=Hi(this));return this.Yd},set:function(a){var b=this.Yd;if(b!==a){null===b&&(b=this.Yd=Hi(this));a.type!==X.Grid&&C("Diagram.grid must be a Panel of type Panel.Grid");
var c=b.panel;null!==c&&c.remove(b);this.Yd=a;a.name="GRID";null!==c&&c.add(a);dj(this);this.N();this.g("grid",b,a)}}},viewportBounds:{get:function(){return this.ox}},viewSize:{get:function(){return this.Fp},set:function(a){var b=this.viewSize;b.A(a)||(this.Fp=a=a.I(),this.ta=this.ua=0,a.u()?(this.ua=a.width,this.ta=a.height):null!==this.Ga&&(this.ua=this.Ga.clientWidth||1,this.ta=this.Ga.clientHeight||1),Ei(this),this.Qa(),this.g("viewSize",
b,a),this.redraw())}},fixedBounds:{get:function(){return this.Fu},set:function(a){var b=this.Fu;b.A(a)||(-Infinity!==a.width&&Infinity!==a.height&&-Infinity!==a.height||C("fixedBounds width/height must not be Infinity"),this.Fu=a=a.I(),this.Qa(),this.g("fixedBounds",b,a))}},scrollMargin:{get:function(){return this.Fj},set:function(a){"number"===typeof a&&(a=new kc(a));var b=this.Fj;b.A(a)||(this.Fj=a=a.I(),this.g("scrollMargin",b,a),this.nq())}},
scrollMode:{get:function(){return this.Gj},set:function(a){var b=this.Gj;b!==a&&(this.Gj=a,a===Nh&&Ni(this,!1),this.g("scrollMode",b,a),this.N())}},scrollsPageOnFocus:{get:function(){return this.at},set:function(a){var b=this.at;b!==a&&(this.at=a,this.g("scrollsPageOnFocus",b,a))}},positionComputation:{get:function(){return this.cw},set:function(a){var b=this.cw;b!==a&&(this.cw=a,Ni(this,!1),this.g("positionComputation",
b,a))}},scaleComputation:{get:function(){return this.dw},set:function(a){var b=this.dw;b!==a&&(this.dw=a,Lj(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{get:function(){return this.Tq}},isVirtualized:{get:function(){return this.iv},set:function(a){var b=this.iv;b!==a&&(this.iv=a,this.g("isVirtualized",b,a))}},scale:{get:function(){return this.sa},
set:function(a){var b=this.sa;b!==a&&Lj(this,b,a)}},defaultScale:{get:function(){return this.Rq},set:function(a){this.Rq=a}},autoScale:{get:function(){return this.Ph},set:function(a){var b=this.Ph;b!==a&&(this.Ph=a,this.g("autoScale",b,a),a!==mh&&Ni(this,!1))}},initialAutoScale:{get:function(){return this.Qg},set:function(a){var b=this.Qg;b!==a&&(this.Qg=a,this.g("initialAutoScale",b,a))}},initialViewportSpot:{
get:function(){return this.gv},set:function(a){var b=this.gv;b!==a&&(a.hb()||C("initialViewportSpot must be a specific Spot: "+a),this.gv=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{get:function(){return this.Xu},set:function(a){var b=this.Xu;b!==a&&(a.hb()||C("initialViewportSpot must be a specific Spot: "+a),this.Xu=a,this.g("initialDocumentSpot",b,a))}},minScale:{get:function(){return this.sv},set:function(a){var b=
this.sv;b!==a&&(0<a?(this.sv=a,this.g("minScale",b,a),a>this.scale&&(this.scale=a)):xa(a,"> 0",R,"minScale"))}},maxScale:{get:function(){return this.ov},set:function(a){var b=this.ov;b!==a&&(0<a?(this.ov=a,this.g("maxScale",b,a),a<this.scale&&(this.scale=a)):xa(a,"> 0",R,"maxScale"))}},zoomPoint:{get:function(){return this.et},set:function(a){this.et.A(a)||(this.et=a=a.I())}},contentAlignment:{get:function(){return this.Gk},
set:function(a){var b=this.Gk;b.A(a)||(this.Gk=a=a.I(),this.g("contentAlignment",b,a),Ni(this,!1))}},initialContentAlignment:{get:function(){return this.hr},set:function(a){var b=this.hr;b.A(a)||(this.hr=a=a.I(),this.g("initialContentAlignment",b,a))}},padding:{get:function(){return this.nb},set:function(a){"number"===typeof a&&(a=new kc(a));var b=this.nb;b.A(a)||(this.nb=a=a.I(),this.Qa(),this.g("padding",b,a))}},partManager:{
get:function(){return this.ow},set:function(a){var b=this.ow;b!==a&&(null!==a.diagram&&C("Cannot share PartManagers between Diagrams: "+a.toString()),b&&b.Ne(null),this.ow=a,a.Ne(this))}},nodes:{get:function(){return this.partManager.nodes.iterator}},links:{get:function(){return this.partManager.links.iterator}},parts:{get:function(){return this.partManager.parts.iterator}},layout:{
get:function(){return this.Ec},set:function(a){var b=this.Ec;b!==a&&(this.Ec=a,a.diagram=this,a.group=null,this.Oh=!0,this.g("layout",b,a),this.Fb())}},isTreePathToChildren:{get:function(){return this.hv},set:function(a){var b=this.hv;if(b!==a&&(this.hv=a,this.g("isTreePathToChildren",b,a),!this.undoManager.isUndoingRedoing))for(a=this.nodes;a.next();)vk(a.value)}},treeCollapsePolicy:{get:function(){return this.bt},set:function(a){var b=
this.bt;b!==a&&(a!==ri&&a!==wk&&a!==xk&&C("Unknown Diagram.treeCollapsePolicy: "+a),this.bt=a,this.g("treeCollapsePolicy",b,a))}},Ke:{get:function(){return this.jw},set:function(a){this.jw=a}},autoScrollInterval:{get:function(){return this.Bq},set:function(a){var b=this.Bq;b!==a&&(this.Bq=a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{get:function(){return this.Dq},set:function(a){"number"===typeof a&&
(a=new kc(a));var b=this.Dq;b.A(a)||(this.Dq=a=a.I(),this.Qa(),this.g("autoScrollRegion",b,a))}}});na.Object.defineProperties(R,{licenseKey:{get:function(){return yk.$b()},set:function(a){yk.add(a.replace(/\s/g,""))}},version:{get:function(){return zk}}});R.prototype.makeImageData=R.prototype.gy;R.prototype.makeImage=R.prototype.sA;R.prototype.cacheGroupExternalLinks=R.prototype.zu;R.prototype.addRenderer=R.prototype.cz;
R.prototype.makeSVG=R.prototype.kv;R.prototype.makeSvg=R.prototype.Is;R.prototype.stopAutoScroll=R.prototype.tg;R.prototype.doAutoScroll=R.prototype.ms;R.prototype.isUnoccupied=R.prototype.dk;R.prototype.raiseDiagramEvent=R.prototype.S;R.prototype.removeDiagramListener=R.prototype.km;R.prototype.addDiagramListener=R.prototype.Lj;R.prototype.findTreeRoots=R.prototype.Wz;R.prototype.layoutDiagram=R.prototype.qA;R.prototype.findTopLevelGroups=R.prototype.Pz;R.prototype.findTopLevelNodesAndLinks=R.prototype.Qz;
R.prototype.ensureBounds=R.prototype.Ta;R.prototype.findLinksByExample=R.prototype.ps;R.prototype.findNodesByExample=R.prototype.qs;R.prototype.findLinkForData=R.prototype.yc;R.prototype.findNodeForData=R.prototype.Gi;R.prototype.findPartForData=R.prototype.zc;R.prototype.findLinkForKey=R.prototype.findLinkForKey;R.prototype.findNodeForKey=R.prototype.Eb;R.prototype.findPartForKey=R.prototype.findPartForKey;R.prototype.rebuildParts=R.prototype.Ld;R.prototype.transformViewToDoc=R.prototype.Xs;
R.prototype.transformRectDocToView=R.prototype.WA;R.prototype.transformDocToView=R.prototype.vq;R.prototype.centerRect=R.prototype.ks;R.prototype.scrollToRect=R.prototype.Fv;R.prototype.scroll=R.prototype.scroll;R.prototype.highlightCollection=R.prototype.hA;R.prototype.highlight=R.prototype.gA;R.prototype.selectCollection=R.prototype.NA;R.prototype.select=R.prototype.select;R.prototype.updateAllRelationshipsFromData=R.prototype.yq;R.prototype.updateAllTargetBindings=R.prototype.updateAllTargetBindings;
R.prototype.commit=R.prototype.commit;R.prototype.rollbackTransaction=R.prototype.Hf;R.prototype.commitTransaction=R.prototype.Xa;R.prototype.startTransaction=R.prototype.xa;R.prototype.raiseChanged=R.prototype.g;R.prototype.raiseChangedEvent=R.prototype.Wa;R.prototype.removeChangedListener=R.prototype.pk;R.prototype.addChangedListener=R.prototype.yh;R.prototype.removeModelChangedListener=R.prototype.IA;R.prototype.addModelChangedListener=R.prototype.vx;R.prototype.findLayer=R.prototype.Xj;
R.prototype.removeLayer=R.prototype.GA;R.prototype.addLayerAfter=R.prototype.Zy;R.prototype.addLayerBefore=R.prototype.tx;R.prototype.addLayer=R.prototype.Sl;R.prototype.moveParts=R.prototype.moveParts;R.prototype.copyParts=R.prototype.Tj;R.prototype.removeParts=R.prototype.Ps;R.prototype.remove=R.prototype.remove;R.prototype.add=R.prototype.add;R.prototype.clearDelayedGeometries=R.prototype.Au;R.prototype.setProperties=R.prototype.xm;R.prototype.attach=R.prototype.wu;R.prototype.set=R.prototype.set;
R.prototype.resetInputOptions=R.prototype.qy;R.prototype.setInputOption=R.prototype.OA;R.prototype.getInputOption=R.prototype.am;R.prototype.resetRenderingHints=R.prototype.sy;R.prototype.setRenderingHint=R.prototype.wy;R.prototype.getRenderingHint=R.prototype.Ie;R.prototype.maybeUpdate=R.prototype.hd;R.prototype.requestUpdate=R.prototype.Fb;R.prototype.delayInitialization=R.prototype.uz;R.prototype.isUpdateRequested=R.prototype.mA;R.prototype.invalidateDocumentBounds=R.prototype.Qa;
R.prototype.findObjectsNear=R.prototype.pg;R.prototype.findPartsNear=R.prototype.Lz;R.prototype.findObjectsIn=R.prototype.zf;R.prototype.findPartsIn=R.prototype.Px;R.prototype.findObjectsAt=R.prototype.Hi;R.prototype.findPartsAt=R.prototype.Kz;R.prototype.findObjectAt=R.prototype.Zb;R.prototype.findPartAt=R.prototype.Zl;R.prototype.focusObject=R.prototype.Xz;R.prototype.alignDocument=R.prototype.ez;R.prototype.zoomToRect=R.prototype.$A;R.prototype.zoomToFit=R.prototype.zoomToFit;
R.prototype.diagramScroll=R.prototype.Gx;R.prototype.focus=R.prototype.focus;
var hi=new I,Fi=null,Jg=void 0!==x.document,ui=null,Bi="",mh=new D(R,"None",0),Si=new D(R,"Uniform",1),Ti=new D(R,"UniformToFill",2),zf=new D(R,"CycleAll",10),Gf=new D(R,"CycleNotDirected",11),If=new D(R,"CycleNotDirectedFast",12),Jf=new D(R,"CycleNotUndirected",13),Df=new D(R,"CycleDestinationTree",14),Ff=new D(R,"CycleSourceTree",15),Nh=new D(R,"DocumentScroll",1),Ph=new D(R,"InfiniteScroll",2),ri=new D(R,"TreeParentCollapsed",21),wk=new D(R,"AllParentsCollapsed",22),xk=new D(R,"AnyParentsCollapsed",
23),yk=new F,zk="2.2.7",tk="image",Ak=null,fi=!1;
function gi(){if(Jg){var a=x.document.createElement("canvas"),b=a.getContext("2d"),c=Qa("7ca11abfd022028846");b[c]=Qa("398c3597c01238");for(var d=["5da73c80a36455d6038e4972187c3cae51fd22",sa.Dx+"4ae6247590da4bb21c324ba3a84e385776",nd.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",L.za],e=1;5>e;e++)b[Qa("7ca11abfd7330390")](Qa(d[e-1]),10,15*e);b[c]=Qa("39f046ebb36e4b");for(c=1;5>c;c++)b[Qa("7ca11abfd7330390")](Qa(d[c-1]),10,15*c);if(4!==d.length||"5"!==d[0][0]||"7"!==d[3][0])nd.prototype.Hd=nd.prototype.yx;
Ak=a}}R.className="Diagram";R.fromDiv=function(a){var b=a;"string"===typeof a&&(b=x.document.getElementById(a));return b instanceof HTMLDivElement&&b.C instanceof R?b.C:null};R.inherit=function(a,b){function c(){}if(Object.getPrototypeOf(a).prototype)throw Error("Used go.Diagram.inherit defining already defined class \n"+a);c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};R.useDOM=function(a){Jg=a?void 0!==x.document:!1};R.isUsingDOM=function(){return Jg};R.None=mh;R.Uniform=Si;
R.UniformToFill=Ti;R.CycleAll=zf;R.CycleNotDirected=Gf;R.CycleNotDirectedFast=If;R.CycleNotUndirected=Jf;R.CycleDestinationTree=Df;R.CycleSourceTree=Ff;R.DocumentScroll=Nh;R.InfiniteScroll=Ph;R.TreeParentCollapsed=ri;R.AllParentsCollapsed=wk;R.AnyParentsCollapsed=xk;function ni(){this.Uy=null;this.j="zz@orderNum";"63ad05bbe23a1786468a4c741b6d2"===this._tk?this.ld=this.j=!0:this.ld=null}
function mj(a,b){b.Vb.setTransform(b.dc,0,0,b.dc,0,0);b.Vb.Ed();if(null===a.ld)a:{b="f";var c=x[Qa("76a715b2f73f148a")][Qa("72ba13b5")];a.ld=!0;if(Jg){var d=R[Qa("76a115b6ed251eaf4692")];if(d)for(var e=yk.iterator;e.next();){d=e.value;d=Qa(d).split(Qa("39e9"));if(6>d.length)break;var f=Qa(d[1]).split(".");if("7da71ca0"!==d[4])break;var g=Qa(sa[Qa("6cae19")]).split(".");if(f[0]>g[0]||f[0]===g[0]&&f[1]>=g[1]){var h=x[Qa("74a900bae4370f8b51")][Qa("6fbb13a1c2311e8a57")].toLowerCase();g=h[Qa("73a612b6fb191d")](Qa("3aad1ab6e022098b4dc4"));
f=Qa(d[2]);if(-1<g&&(h=h[Qa("73a612b6fb191d")](f.toLowerCase()+"/"),a.ld=!(-1<h&&h<g),!a.ld))break;g=c[Qa("76ad18b4f73e")];for(h=c[Qa("73a612b6fb191d")](Qa("35e7"))+2;h<g;h++)b+=c[h];g=b[Qa("73a612b6fb191d")](f);0>g&&f!==Qa("7da71ca0ad381e90")&&(g=b[Qa("73a612b6fb191d")](Qa("76a715b2ef3e149757")));0>g&&(g=b[Qa("73a612b6fb191d")](Qa("76a715b2ef3e149757")));0>g&&(g=c[Qa("73a612b6fb191d")](Qa("7baa19a6f76c1988428554")));a.ld=!(0<=g&&g<b[Qa("73a612b6fb191d")](Qa("35"))||-1===b[Qa("73a612b6fb191d")](Qa("35")));
if(!a.ld)break;if(c[Qa("73a612b6fb191d")](Qa("7fb002b6ed25128b4da25b2e"))&&c[Qa("73a612b6fb191d")](Qa("75ba1beee63a1e875799507d"))&&(a.ld=!(-1<c[Qa("73a612b6fb191d")](f)),!a.ld))break;if("#"===f[0]){g=x.document.createElement("div");for(var k=d[0].replace(/[A-Za-z]/g,"");4>k.length;)k+="9";h=k;k=k.substr(k.length-4);d="";d+=["gsh","gsf"][parseInt(k.substr(0,1),10)%2];d+=["Header","Background","Display","Feedback"][parseInt(k.substr(0,1),10)%4];g[Qa("79a417a0f0181a8946")]=d;if(x.document[Qa("78a712aa")]){x.document[Qa("78a712aa")][Qa("7bb806b6ed32388c4a875b")](g);
k=x.getComputedStyle(g).getPropertyValue(Qa("78a704b7e62456904c9b12701b6532a8"));var l=x.getComputedStyle(g).getPropertyValue(Qa("75b817b0ea2202"));x.document[Qa("78a712aa")][Qa("68ad1bbcf533388c4a875b")](g);if(k)if(g=x[Qa("77a902b0eb1b1e804a8a")],l==="0."+parseInt(h,10)%100||-1!==k.indexOf(parseInt(f[1]+f[2],16))&&-1!==k.indexOf(parseInt(f[3]+f[4],16))){a.ld=!1;break}else if(g&&g(Qa("32ae19a1e0331fc94084537c067a67fa59f1386b89d006")).matches)for(d="."+d,f=0;f<document.styleSheets.length;f++){g=document.styleSheets[f].rules||
document.styleSheets[f].cssRules;for(var m in g)if(d===g[m].selectorText){a.ld=!1;break a}}}else a.ld=null,a.ld=!1}}}else{m=c[Qa("76ad18b4f73e")];for(e=c[Qa("73a612b6fb191d")](Qa("35e7"))+2;e<m;e++)b+=c[e];c=b[Qa("73a612b6fb191d")](Qa("7da71ca0ad381e90"));a.ld=!(0<=c&&c<b[Qa("73a612b6fb191d")](Qa("35")))}}}return 0<a.ld&&a!==a.Uy?!0:!1}
function oi(a,b){if(Jg){void 0!==b&&null!==b||C("Diagram setup requires an argument DIV.");null!==a.Ga&&C("Diagram has already completed setup.");"string"===typeof b?a.Ga=x.document.getElementById(b):b instanceof HTMLDivElement?a.Ga=b:C("No DIV or DIV id supplied: "+b);null===a.Ga&&C("Invalid DIV id; could not get element with id: "+b);void 0!==a.Ga.C&&C("Invalid div id; div already has a Diagram associated with it.");if(!a.xl&&x.ResizeObserver){var c=ta(function(){a.Fb()},250);a.xl=new x.ResizeObserver(function(){c()});
a.xl.observe(a.Ga)}"static"===x.getComputedStyle(a.Ga,null).position&&(a.Ga.style.position="relative");b=5;var d="rgba(2"+b+"5, 255, 255, 0)";b--;a.Ga.style["-webkit-tap-highlight-color"]=d;a.Ga.innerHTML="";a.Ga.C=a;a.Ga.goDiagram=a;a.Ga.go=x.go;var e=a.Zr?new rj(a):new uk(a);void 0!==e.style&&(e.style.position="absolute",e.style.top="0px",e.style.left="0px","rtl"===x.getComputedStyle(a.Ga,null).getPropertyValue("direction")&&(a.Vn=!0),e.style.zIndex="2",e.style.userSelect="none",e.style.MozUserSelect=
"none",e.style.touchAction="none");a.Ca=e;a.Vb=e.context;d=a.Vb;a.dc=a.computePixelRatio();a.viewSize.u()||(a.ua=a.Ga.clientWidth||1,a.ta=a.Ga.clientHeight||1);tj(a,a.ua,a.ta);a.Ga.insertBefore(e.La,a.Ga.firstChild);e=new uk(null);e.width=1;e.height=1;a.Iw=e;a.Ny=e.context;if(Jg){e=va("div");var f=va("div");e.style.position="absolute";e.style.overflow="auto";e.style.width=a.ua+"px";e.style.height=a.ta+"px";e.style.zIndex="1";f.style.position="absolute";f.style.width="1px";f.style.height="1px";a.Ga.appendChild(e);
e.appendChild(f);e.onscroll=Ii;e.addEventListener("pointerdown",Ki);e.C=a;e.Sy=!0;e.Ty=!0;a.fu=e;a.du=f}a.nq=ta(function(){a.si=null;a.N()},300);a.Zv=ta(function(){nh(a)},250);a.preventDefault=function(a){a.preventDefault();return!1};a.gk=function(b){if(a.isEnabled){var c=Xi(a,b,!0);c.bubbles=!0;var d=0,e=0;c.delta=0;void 0!==b.deltaX?(0!==b.deltaX&&(d=0<b.deltaX?1:-1),0!==b.deltaY&&(e=0<b.deltaY?1:-1),c.delta=Math.abs(b.deltaX)>Math.abs(b.deltaY)?-d:-e):void 0!==b.wheelDeltaX?(0!==b.wheelDeltaX&&
(d=0<b.wheelDeltaX?-1:1),0!==b.wheelDeltaY&&(e=0<b.wheelDeltaY?-1:1),c.delta=Math.abs(b.wheelDeltaX)>Math.abs(b.wheelDeltaY)?-d:-e):void 0!==b.wheelDelta&&0!==b.wheelDelta&&(c.delta=0<b.wheelDelta?1:-1);a.doMouseWheel();aj(c,b)}};a.xA=function(b){a.isEnabled&&(a.cl=!1,Xi(a,b,!0),b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())};a.jk=function(b){if(a.isEnabled){a.cl=!0;var c=a.Wt;void 0===c[b.pointerId]&&(c[b.pointerId]=b);c=a.ul;var d=!1;if(null!==c[0]&&c[0].pointerId===b.pointerId)c[0]=
b;else if(null!==c[1]&&c[1].pointerId===b.pointerId)c[1]=b,d=!0;else if(null===c[0])c[0]=b;else if(null===c[1])c[1]=b,d=!0;else{b.preventDefault();return}if(c="touch"===b.pointerType||"pen"===b.pointerType)a.ju=!1,a.Mt=!0;var e=d;d=$i(a,b,!0,!1,!0,e);Yi(a,b,d);d.targetDiagram=Zi(b,b.target);d.targetObject=null;e||d.clone(a.br);e=a.Rw;c=c?25:10;b.timeStamp-a.Qw<a.Xy&&!(Math.abs(e.x-b.screenX)>c||Math.abs(e.y-b.screenY)>c)?a.rr++:a.rr=1;d.clickCount=a.rr;a.Qw=b.timeStamp;a.Rw.sg(b.screenX,b.screenY);
a.doMouseDown();1===b.button?b.preventDefault():aj(d,b)}};a.kk=function(b){if(a.isEnabled){a.cl=!0;var c=a.ul;if(null!==c[0]&&c[0].pointerId===b.pointerId)c[0]=b;else{if(null!==c[1]&&c[1].pointerId===b.pointerId){c[1]=b;return}if(null===c[0])c[0]=b;else return}if(c[0].pointerId===b.pointerId){c=$i(a,b,!1,!1,!1,null!==c[1]);var d=x.document.elementFromPoint(b.clientX,b.clientY);null!==d&&void 0!==d.shadowRoot&&null!==d.shadowRoot&&(d=d.shadowRoot.elementFromPoint(b.clientX,b.clientY));var e=a,f=b;
d&&d.C&&(f=b,e=d.C);c.targetDiagram=e;Yi(a,f,c);c.targetObject=null;a.doMouseMove();aj(c,b)}}};a.mk=function(b){if(a.isEnabled){a.cl=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.Wt;if(c&&a.ju)delete d[b.pointerId],b.preventDefault();else if(d=a.ul,null!==d[0]&&d[0].pointerId===b.pointerId){d[0]=null;d=$i(a,b,!1,!0,!0,!1);var e=x.document.elementFromPoint(b.clientX,b.clientY);null!==e&&void 0!==e.shadowRoot&&null!==e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(b.clientX,b.clientY));
null!==e&&e.C instanceof R&&e.C!==a&&Yi(e.C,b,d);null===e&&(e=b.target);Yi(a,b,d);d.clickCount=a.rr;d.targetDiagram=Zi(b,e);d.targetObject=null;a.doMouseUp();aj(d,b);c&&(a.Mt=!1)}else null!==d[1]&&d[1].pointerId===b.pointerId&&(d[1]=null)}};a.lk=function(b){if(a.isEnabled){a.cl=!1;var c=a.Wt;c[b.pointerId]&&delete c[b.pointerId];c=a.ul;null!==c[0]&&c[0].pointerId===b.pointerId&&(c[0]=null);null!==c[1]&&c[1].pointerId===b.pointerId&&(c[1]=null);"touch"!==b.pointerType&&"pen"!==b.pointerType&&(b=a.currentTool,
b.cancelWaitAfter(),b.standardMouseOver())}};a.zt=d.Y["d"+Bk[1]+Bk[2]+"wI"+tk.slice(1,5)]["b"+Ck.slice(1,b)](d.Y,Ak,b,b);d.Ic(!0);Gi(a)}}ni.className="DiagramHelper";function Se(a){this.j=void 0===a?new J:a;this.o=new J}na.Object.defineProperties(Se.prototype,{point:{get:function(){return this.j},set:function(a){this.j=a}},shifted:{get:function(){return this.o},set:function(a){this.o=a}}});var Bk="DraggingInfo";Se.className="DraggingInfo";
function Ej(a,b,c){this.node=a;this.info=b;this.Wu=c}Ej.className="DraggingNodeInfoPair";function Le(){this.reset()}Le.prototype.reset=function(){this.isGridSnapEnabled=!1;this.isGridSnapRealtime=!0;this.gridSnapCellSize=(new Fb(NaN,NaN)).freeze();this.gridSnapCellSpot=tc;this.gridSnapOrigin=(new J(NaN,NaN)).freeze();this.groupsSnapMembers=this.dragsTree=this.dragsLink=!1;this.dragsMembers=this.groupsAlwaysMove=!0};Le.className="DraggingOptions";
function Dk(a,b){if("string"===typeof a||x.Element&&a instanceof Element)var c=R.call(this,a)||this;else c=R.call(this)||this,b=a;Ek(c);b&&c.xm(b);return c}ma(Dk,R);function Ek(a){a.allowDragOut=!0;a.allowMove=!1;a.isReadOnly=!0;a.contentAlignment=uc;a.layout=new Fk}Dk.prototype.reset=function(){R.prototype.reset.call(this);Ek(this)};Dk.className="Palette";
function Gk(a,b){if("string"===typeof a||x.Element&&a instanceof Element)var c=R.call(this,a)||this;else c=R.call(this)||this,b=a;var d=c;c.animationManager.isEnabled=!1;c.qb=!0;c.Ov=null;c.Mn=!1;c.Nn=!1;c.yu=!0;c.xu=!0;c.ct=0;c.$i=!1;c.El=null;c.wy("drawShadows",!1);a=new V;var e=new xf;e.stroke="magenta";e.strokeWidth=2;e.fill="transparent";e.name="BOXSHAPE";a.selectable=!0;a.selectionAdorned=!1;a.selectionObjectName="BOXSHAPE";a.locationObjectName="BOXSHAPE";a.resizeObjectName="BOXSHAPE";a.cursor=
"move";a.add(e);c.Yi=a;c.allowCopy=!1;c.allowDelete=!1;c.allowSelect=!0;c.autoScrollRegion=new kc(0,0,0,0);c.ja.h(0,0);c.toolManager.Za("Dragging",new Hk,c.toolManager.mouseMoveTools);c.click=function(){var a=d.observed;if(null!==a){var b=a.viewportBounds,c=d.lastInput.documentPoint;a.position=new J(c.x-b.width/2,c.y-b.height/2)}};c.uw=function(){d.Qa();Ik(d)};c.tw=function(){null!==d.observed&&(d.Qa(),d.N())};c.ft=function(){1>d.updateDelay?d.N():d.$i||(d.$i=!0,setTimeout(function(){return d.redraw()},
d.updateDelay))};c.sw=function(){null!==d.observed&&Ik(d)};c.autoScale=Si;c.qb=!1;b&&Object.assign(c,b);return c}ma(Gk,R);Gk.prototype.computePixelRatio=function(){return 1};
Gk.prototype.redraw=function(){if(this.$i&&1<=this.updateDelay){this.$i=!1;var a=this.Ca,b=this.Vb;if(null!==a&&null!==b){kj(this);if(null===this.El){var c=new uk(null);c.width=a.width;c.height=a.height;this.El=c}try{this.Ca=this.El,this.Vb=this.Ca.context,this.Vb.Ic(!0),this.Vb.setTransform(1,0,0,1,0,0),this.Vb.clearRect(0,0,this.Ca.width,this.Ca.height),Jk(this)}finally{this.Ca=a,this.Vb=b}}}R.prototype.redraw.call(this)};
Gk.prototype.oc=function(){null===this.Ga&&C("No div specified");null===this.Ca&&C("No canvas specified");if(!(this.Ca instanceof rj)&&(ai(this.box),this.Wc)){var a=this.observed;if(null!==a&&!a.animationManager.defaultAnimation.isAnimating&&a.Oi){kj(this);var b=this.Ca;a=this.Vb;a.Ic(!0);a.setTransform(1,0,0,1,0,0);a.clearRect(0,0,b.width,b.height);1>this.updateDelay?Jk(this):null!==this.El&&(a.drawImage(this.El.La,0,0),b=this.vb,b.reset(),1!==this.scale&&b.scale(this.scale),0===this.position.x&&
0===this.position.y||b.translate(-this.position.x,-this.position.y),a.scale(this.dc,this.dc),a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy));b=this.Oa.m;for(var c=b.length,d=0;d<c;d++)b[d].oc(a,this);this.Wc=this.lj=!1}}};
function Jk(a){var b=a.observed;if(null!==b){var c=a.drawsTemporaryLayers,d=a.drawsGrid&&c,e=b.grid;d&&null!==e&&e.visible&&!isNaN(e.width)&&!isNaN(e.height)&&(e=M.alloc().assign(a.viewportBounds).Rc(b.viewportBounds),dj(b,e),M.free(e),hh(b));var f=a.vb;f.reset();1!==a.scale&&f.scale(a.scale);0===a.position.x&&0===a.position.y||f.translate(-a.position.x,-a.position.y);e=a.Vb;e.scale(a.dc,a.dc);e.transform(f.m11,f.m12,f.m21,f.m22,f.dx,f.dy);b=b.Oa.m;f=b.length;for(var g=0;g<f;g++){var h=b[g],k=a;if(h.visible&&
0!==h.opacity){var l=h.diagram.grid.part;if(!c&&h.isTemporary)d&&l.layer===h&&(h=bi(h,e),l.oc(e,k),e.globalAlpha=h);else{for(var m=bi(h,e),n=k.scale,p=M.alloc(),r=h.Ha.m,q=r.length,u=0;u<q;u++){var w=r[u];(d||w!==l)&&h.Di(e,w,k,null,n,p,!1)}M.free(p);e.globalAlpha=m}}}}}
function Ik(a){var b=a.box;if(null!==b){var c=a.observed;if(null!==c){a.Wc=!0;c=c.viewportBounds;var d=b.selectionObject,e=Fb.alloc();e.h(c.width,c.height);d.desiredSize=e;Fb.free(e);a=2/a.scale;d instanceof xf&&(d.strokeWidth=a);b.location=new J(c.x-a/2,c.y-a/2);b.isSelected=!0}}}Gk.prototype.computeBounds=function(){var a=this.observed;if(null===a)return gc;var b=a.documentBounds.copy();b.Rc(a.viewportBounds);return b};Gk.prototype.invalidateViewport=function(){!0!==this.Wc&&(this.Wc=!0,this.Fb())};
Gk.prototype.onViewportBoundsChanged=function(a,b,c,d){this.qb||(Li(this),this.N(),Qi(this),this.Qa(),Ik(this),this.ed.scale=c,this.ed.position.x=a.x,this.ed.position.y=a.y,this.ed.bounds.assign(a),this.ed.by=d,this.S("ViewportBoundsChanged",this.ed,a))};
na.Object.defineProperties(Gk.prototype,{observed:{get:function(){return this.Ov},set:function(a){var b=this.Ov;a instanceof Gk&&C("Overview.observed Diagram may not be an Overview itself: "+a);if(b!==a){null!==b&&(this.remove(this.box),b.km("ViewportBoundsChanged",this.uw),b.km("DocumentBoundsChanged",this.tw),b.km("InvalidateDraw",this.ft),b.km("AnimationFinished",this.sw));this.Ov=a;null!==a&&(a.Lj("ViewportBoundsChanged",this.uw),a.Lj("DocumentBoundsChanged",this.tw),
a.Lj("InvalidateDraw",this.ft),a.Lj("AnimationFinished",this.sw),this.add(this.box));this.Qa();if(null===a){this.El=null;var c=this.Ca,d=this.Vb;c&&d&&(d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,c.width,c.height))}else this.ft(null),Ik(this),this.N();this.g("observed",b,a)}}},box:{get:function(){return this.Yi},set:function(a){var b=this.Yi;b!==a&&(this.Yi=a,this.remove(b),this.add(this.Yi),Ik(this),this.g("box",b,a))}},drawsTemporaryLayers:{
get:function(){return this.yu},set:function(a){this.yu!==a&&(this.yu=a,this.redraw())}},drawsGrid:{get:function(){return this.xu},set:function(a){this.xu!==a&&(this.xu=a,this.redraw())}},updateDelay:{get:function(){return this.ct},set:function(a){0>a&&(a=0);this.ct!==a&&(this.ct=a)}}});Gk.className="Overview";function Hk(){Fe.call(this);this.j=null}ma(Hk,Fe);
Hk.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||!a.allowMove||!a.allowSelect)return!1;var b=a.observed;if(null===b)return!1;var c=a.lastInput;if(!c.left||a.currentTool!==this&&(!this.isBeyondDragSize()||c.isTouchEvent&&c.timestamp-a.firstInput.timestamp<this.delay))return!1;null===this.findDraggablePart()&&(c=b.viewportBounds,this.j=new J(c.width/2,c.height/2),a=a.firstInput.documentPoint,b.position=new J(a.x-this.j.x,a.y-this.j.y));return!0};
Hk.prototype.doActivate=function(){this.j=null;Fe.prototype.doActivate.call(this)};Hk.prototype.doUpdateCursor=function(){var a=this.diagram,b=a.box;null!==b&&b.cursor&&(a.currentCursor=b.cursor)};Hk.prototype.moveParts=function(){var a=this.diagram,b=a.observed;if(null!==b){var c=a.box;if(null!==c){if(null===this.j){var d=a.firstInput.documentPoint;c=c.location;this.j=new J(d.x-c.x,d.y-c.y)}a=a.lastInput.documentPoint;b.position=new J(a.x-this.j.x,a.y-this.j.y)}}};Hk.className="OverviewDraggingTool";
function Kk(){Ua(this);this.C=ue;this.Ma=this.D=this.o=!0;this.L=this.wa=this.Qb=this.Ba=!1;this.ki=this.j=null;this.rc=1.05;this.Nt=NaN;this.Pw=null;this.qu=NaN;this.pu=gc;this.Gb=!0;this.dg=null;this.Rb=200}Kk.prototype.toString=function(){return"CommandHandler"};Kk.prototype.Ne=function(a){this.C=a};
Kk.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput,c=Ta?b.meta:b.control,d=b.shift,e=b.alt,f=b.key;!c||"C"!==f&&"Insert"!==f?c&&"X"===f||d&&"Del"===f?this.canCutSelection()&&this.cutSelection():c&&"V"===f||d&&"Insert"===f?this.canPasteSelection()&&this.pasteSelection():c&&"Y"===f||e&&d&&"Backspace"===f?this.canRedo()&&this.redo():c&&"Z"===f||e&&"Backspace"===f?this.canUndo()&&this.undo():"Del"===f||"Backspace"===f?this.canDeleteSelection()&&this.deleteSelection():c&&"A"===f?this.canSelectAll()&&
this.selectAll():"Esc"===f?this.canStopCommand()&&this.stopCommand():"Up"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","up"):a.scroll("line","up")):"Down"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","down"):a.scroll("line","down")):"Left"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","left"):a.scroll("line","left")):"Right"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","right"):a.scroll("line","right")):"PageUp"===f?d&&a.allowHorizontalScroll?a.scroll("page","left"):a.allowVerticalScroll&&
a.scroll("page","up"):"PageDown"===f?d&&a.allowHorizontalScroll?a.scroll("page","right"):a.allowVerticalScroll&&a.scroll("page","down"):"Home"===f?c&&a.allowVerticalScroll?a.scroll("document","up"):!c&&a.allowHorizontalScroll&&a.scroll("document","left"):"End"===f?c&&a.allowVerticalScroll?a.scroll("document","down"):!c&&a.allowHorizontalScroll&&a.scroll("document","right"):" "===f?this.canScrollToPart()&&this.scrollToPart():"Subtract"===f?this.canDecreaseZoom()&&this.decreaseZoom():"Add"===f?this.canIncreaseZoom()&&
this.increaseZoom():c&&"0"===f?this.canResetZoom()&&this.resetZoom():d&&"Z"===f?this.canZoomToFit()&&this.zoomToFit():c&&!d&&"G"===f?this.canGroupSelection()&&this.groupSelection():c&&d&&"G"===f?this.canUngroupSelection()&&this.ungroupSelection():"F2"===f||b.event&&"F2"===b.event.key?this.canEditTextBlock()&&this.editTextBlock():"ContextMenu"===f||b.event&&"ContextMenu"===b.event.key?this.canShowContextMenu()&&this.showContextMenu():b.bubbles=!0:this.canCopySelection()&&this.copySelection()};
Kk.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0};Kk.prototype.stopCommand=function(){var a=this.diagram,b=a.currentTool;b instanceof Pa&&a.allowSelect&&a.clearSelection();null!==b&&b.doCancel()};Kk.prototype.canStopCommand=function(){return!0};
Kk.prototype.selectAll=function(){var a=this.diagram;a.N();try{a.currentCursor="wait";a.S("ChangingSelection",a.selection);for(var b=a.parts;b.next();)b.value.isSelected=!0;for(var c=a.nodes;c.next();)c.value.isSelected=!0;for(var d=a.links;d.next();)d.value.isSelected=!0}finally{a.S("ChangedSelection",a.selection),a.currentCursor=""}};Kk.prototype.canSelectAll=function(){return this.diagram.allowSelect};
Kk.prototype.deleteSelection=function(){var a=this.diagram;try{a.currentCursor="wait";a.S("ChangingSelection",a.selection);a.xa("Delete");a.S("SelectionDeleting",a.selection);for(var b=new G,c=a.selection.iterator;c.next();)Lk(b,c.value,!0,this.deletesTree?Infinity:0,this.deletesConnectedLinks?null:!1,function(a){return a.canDelete()});a.Ps(b,!0);a.S("SelectionDeleted",b)}finally{a.Xa("Delete"),a.S("ChangedSelection",a.selection),a.currentCursor=""}};
Kk.prototype.canDeleteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowDelete||0===a.selection.count?!1:!0};Kk.prototype.copySelection=function(){var a=this.diagram,b=new G;for(a=a.selection.iterator;a.next();)Lk(b,a.value,!0,this.copiesTree?Infinity:0,this.copiesConnectedLinks,function(a){return a.canCopy()});this.copyToClipboard(b)};Kk.prototype.canCopySelection=function(){var a=this.diagram;return a.allowCopy&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Kk.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};Kk.prototype.canCutSelection=function(){var a=this.diagram;return!a.isReadOnly&&!a.isModelReadOnly&&a.allowCopy&&a.allowDelete&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Kk.prototype.copyToClipboard=function(a){var b=this.diagram,c=null;if(null===a)ui=null,Bi="";else{c=b.model;var d=!1,e=!1,f=null;try{c.dm()&&(d=c.Sj,c.Sj=this.copiesParentKey),c.bk()&&(e=c.Rj,c.Rj=this.copiesGroupKey),f=b.Tj(a,null,!0)}finally{c.dm()&&(c.Sj=d),c.bk()&&(c.Rj=e),c=new F,c.addAll(f),ui=c,Bi=b.model.dataFormat}}b.S("ClipboardChanged",c)};
Kk.prototype.pasteFromClipboard=function(){var a=new G,b=ui;if(null===b)return a;var c=this.diagram;if(Bi!==c.model.dataFormat)return a;var d=c.model,e=!1,f=!1,g=null;try{d.dm()&&(e=d.Sj,d.Sj=this.copiesParentKey),d.bk()&&(f=d.Rj,d.Rj=this.copiesGroupKey),g=c.Tj(b,c,!1)}finally{for(d.dm()&&(d.Sj=e),d.bk()&&(d.Rj=f),b=g.iterator;b.next();)c=b.value,d=b.key,c.location.u()||(d.location.u()?c.location=d.location:!c.position.u()&&d.position.u()&&(c.position=d.position)),a.add(c)}return a};
Kk.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.currentCursor="wait";b.S("ChangingSelection",b.selection);b.xa("Paste");var c=this.pasteFromClipboard();0<c.count&&b.clearSelection(!0);for(var d=c.iterator;d.next();)d.value.isSelected=!0;if(null!==a){var e=b.computePartsBounds(b.selection);if(e.u()){var f=this.computeEffectiveCollection(b.selection,b.on);jf(b,f,new J(a.x-e.centerX,a.y-e.centerY),b.on,!1)}}b.S("ClipboardPasted",c)}finally{b.Xa("Paste"),b.S("ChangedSelection",
b.selection),b.currentCursor=""}};Kk.prototype.canPasteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowClipboard||null===ui||0===ui.count||Bi!==a.model.dataFormat?!1:!0};Kk.prototype.undo=function(){this.diagram.undoManager.undo()};Kk.prototype.canUndo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canUndo()};Kk.prototype.redo=function(){this.diagram.undoManager.redo()};
Kk.prototype.canRedo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canRedo()};Kk.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;b.autoScale===mh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Kk.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;if(b.autoScale!==mh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
Kk.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;b.autoScale===mh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Kk.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;if(b.autoScale!==mh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Kk.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;a<b.minScale||a>b.maxScale||(b.scale=a)};
Kk.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
Kk.prototype.zoomToFit=function(){var a=this.diagram,b=a.animationManager;b.qc();a.redraw();var c=a.position,d=a.scale;gh(b,"Zoom To Fit");this.isZoomToFitRestoreEnabled&&d===this.qu&&!isNaN(this.Nt)&&a.documentBounds.A(this.pu)?(a.scale=this.Nt,a.position=this.Pw,this.qu=NaN,this.pu=gc):(this.Nt=d,this.Pw=c.copy(),a.zoomToFit(),this.qu=a.scale,this.pu=a.documentBounds.copy());ih(b)};Kk.prototype.canZoomToFit=function(){return this.diagram.allowZoom};
Kk.prototype.scrollToPart=function(a){void 0===a&&(a=null);var b=this.diagram;b.Ta();if(null===a){try{null!==this.dg&&(this.dg.next()?a=this.dg.value:this.dg=null)}catch(k){this.dg=null}null===a&&(0<b.highlighteds.count?this.dg=b.highlighteds.iterator:0<b.selection.count&&(this.dg=b.selection.iterator),null!==this.dg&&this.dg.next()&&(a=this.dg.value))}if(null!==a){var c=b.animationManager;gh(c,"Scroll To Part");var d=this.scrollToPartPause;if(0<d){var e=Mk(this,a,[a]);if(1===e.length)b.xa(),b.ks(a.actualBounds),
b.Xa("Scroll To Part");else{var f=function(){b.xa();for(var a=e.pop();0<e.length&&a instanceof W&&a.isTreeExpanded&&(!(a instanceof U)||a.isSubGraphExpanded);)a=e.pop();0<e.length?(a instanceof V&&b.Fv(a.actualBounds),a instanceof W&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof U&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof V&&b.ks(a.actualBounds),b.km("LayoutCompleted",g));b.Xa("Scroll To Part")},g=function(){ua(f,(c.isEnabled?c.duration:0)+d)};b.Lj("LayoutCompleted",
g);f()}}else{var h=b.position.copy();b.ks(a.actualBounds);h.Ua(b.position)&&c.qc()}}};
function Mk(a,b,c){if(b.isVisible())return c;if(b instanceof ye)Mk(a,b.adornedPart,c);else if(b instanceof T){var d=b.fromNode;null!==d&&Mk(a,d,c);b=b.toNode;null!==b&&Mk(a,b,c)}else b instanceof W&&(d=b.labeledLink,null!==d&&Mk(a,d,c),d=b.qg(),null!==d&&(d.isTreeExpanded||d.wasTreeExpanded||c.push(d),Mk(a,d,c))),b=b.containingGroup,null!==b&&(b.isSubGraphExpanded||b.wasSubGraphExpanded||c.push(b),Mk(a,b,c));return c}
Kk.prototype.canScrollToPart=function(a){void 0===a&&(a=null);if(null!==a&&!(a instanceof V))return!1;a=this.diagram;return 0===a.selection.count&&0===a.highlighteds.count?!1:a.allowHorizontalScroll&&a.allowVerticalScroll};
Kk.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.xa("Collapse Tree");gh(b.animationManager,"Collapse Tree");var c=new F;if(null!==a&&a.isTreeExpanded)a.collapseTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof W&&e.isTreeExpanded&&(e.collapseTree(),c.add(e))}b.S("TreeCollapsed",c)}finally{b.Xa("Collapse Tree")}};
Kk.prototype.canCollapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof W&&a.isTreeExpanded))return!1;if(0<a.Xp().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof W&&b.isTreeExpanded&&0<b.Xp().count)return!0;return!1};
Kk.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.xa("Expand Tree");gh(b.animationManager,"Expand Tree");var c=new F;if(null!==a&&!a.isTreeExpanded)a.expandTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof W&&!e.isTreeExpanded&&(e.expandTree(),c.add(e))}b.S("TreeExpanded",c)}finally{b.Xa("Expand Tree")}};
Kk.prototype.canExpandTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof W)||a.isTreeExpanded)return!1;if(0<a.Xp().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof W&&!b.isTreeExpanded&&0<b.Xp().count)return!0;return!1};
Kk.prototype.groupSelection=function(){var a=this.diagram,b=a.model;if(b.ck()){var c=this.archetypeGroupData;if(null!==c){var d=null;try{a.currentCursor="wait";a.S("ChangingSelection",a.selection);a.xa("Group");for(var e=new F,f=a.selection.iterator;f.next();){var g=f.value;g.Nc()&&g.canGroup()&&e.add(g)}for(var h=new F,k=e.iterator;k.next();){var l=k.value;f=!1;for(var m=e.iterator;m.next();)if(l.Jd(m.value)){f=!0;break}f||h.add(l)}if(0<h.count){var n=h.first().containingGroup;if(null!==n)for(;null!==
n;){e=!1;for(var p=h.iterator;p.next();)if(!p.value.Jd(n)){e=!0;break}if(e)n=n.containingGroup;else break}if(c instanceof U)ng(c),d=c.copy(),null!==d&&a.add(d);else if(b.dv(c)){var r=b.copyNodeData(c);za(r)&&(b.sf(r),d=a.Gi(r))}if(null!==d){null!==n&&this.isValidMember(n,d)&&(d.containingGroup=n);for(var q=h.iterator;q.next();){var u=q.value;this.isValidMember(d,u)&&(u.containingGroup=d)}a.clearSelection(!0);d.isSelected=!0}}a.S("SelectionGrouped",d)}finally{a.Xa("Group"),a.S("ChangedSelection",a.selection),
a.currentCursor=""}}}};Kk.prototype.canGroupSelection=function(){var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowGroup||!a.model.ck()||null===this.archetypeGroupData)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Nc()&&b.canGroup())return!0}return!1};
function Nk(a){var b=Ga();for(a=a.iterator;a.next();){var c=a.value;c instanceof T||b.push(c)}a=new G;c=b.length;for(var d=0;d<c;d++){for(var e=b[d],f=!0,g=0;g<c;g++)if(e.Jd(b[g])){f=!1;break}f&&a.add(e)}Ja(b);return a}
Kk.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof T)return!1;if(null!==a){if(a===b||a.Jd(b))return!1;var c=a.memberValidation;if(null!==c&&!c(a,b)||null===a.data&&null!==b.data||null!==a.data&&null===b.data)return!1}c=this.memberValidation;return null!==c?c(a,b):!0};
Kk.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.model;if(c.ck())try{b.currentCursor="wait";b.S("ChangingSelection",b.selection);b.xa("Ungroup");var d=new F;if(null!==a)d.add(a);else for(var e=b.selection.iterator;e.next();){var f=e.value;f instanceof U&&f.canUngroup()&&d.add(f)}var g=new F;if(0<d.count){b.clearSelection(!0);for(var h=d.iterator;h.next();){var k=h.value;k.expandSubGraph();var l=k.containingGroup,m=null!==l&&null!==l.data?c.pa(l.data):void 0;g.addAll(k.memberParts);
for(var n=g.iterator;n.next();){var p=n.value;p.isSelected=!0;if(!(p instanceof T)){var r=p.data;null!==r?c.tq(r,m):p.containingGroup=l}}b.remove(k)}}b.S("SelectionUngrouped",d,g)}finally{b.Xa("Ungroup"),b.S("ChangedSelection",b.selection),b.currentCursor=""}};
Kk.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowDelete||!b.allowUngroup||!b.model.ck())return!1;if(null!==a){if(!(a instanceof U))return!1;if(a.canUngroup())return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof U&&b.canUngroup())return!0;return!1};
Kk.prototype.addTopLevelParts=function(a,b){var c=!0;for(a=Nk(a).iterator;a.next();){var d=a.value;null!==d.containingGroup&&(!b||this.isValidMember(null,d)?d.containingGroup=null:c=!1)}return c};
Kk.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.xa("Collapse SubGraph");gh(b.animationManager,"Collapse SubGraph");var c=new F;if(null!==a&&a.isSubGraphExpanded)a.collapseSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof U&&e.isSubGraphExpanded&&(e.collapseSubGraph(),c.add(e))}b.S("SubGraphCollapsed",c)}finally{b.Xa("Collapse SubGraph")}};
Kk.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof U&&a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof U&&b.isSubGraphExpanded)return!0;return!1};
Kk.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.xa("Expand SubGraph");gh(b.animationManager,"Expand SubGraph");var c=new F;if(null!==a&&!a.isSubGraphExpanded)a.expandSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof U&&!e.isSubGraphExpanded&&(e.expandSubGraph(),c.add(e))}b.S("SubGraphExpanded",c)}finally{b.Xa("Expand SubGraph")}};
Kk.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof U&&!a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof U&&!b.isSubGraphExpanded)return!0;return!1};
Kk.prototype.editTextBlock=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.toolManager.findTool("TextEditing");if(null!==c){if(null===a){a=null;for(var d=b.selection.iterator;d.next();){var e=d.value;if(e.canEdit()){a=e;break}}if(null===a)return;a=a.Yl(function(a){return a instanceof Lg&&a.editable})}null!==a&&(b.currentTool=null,c.textBlock=a,b.currentTool=c)}};
Kk.prototype.canEditTextBlock=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowTextEdit||null===b.toolManager.findTool("TextEditing"))return!1;if(null!==a){if(!(a instanceof Lg))return!1;a=a.part;if(null!==a&&a.canEdit())return!0}else for(b=b.selection.iterator;b.next();)if(a=b.value,a.canEdit()&&(a=a.Yl(function(a){return a instanceof Lg&&a.editable}),null!==a))return!0;return!1};
Kk.prototype.showContextMenu=function(a){var b=this.diagram,c=b.toolManager.findTool("ContextMenu");if(null!==c&&(void 0===a&&(a=0<b.selection.count?b.selection.first():b),a=c.findObjectWithContextMenu(a),null!==a)){var d=b.lastInput,e=null;a instanceof Y?e=a.da(xc):b.viewportBounds.$(d.documentPoint)||(e=b.viewportBounds,e=new J(e.x+e.width/2,e.y+e.height/2));null!==e&&(d.viewPoint=b.vq(e),d.documentPoint=e,d.left=!1,d.right=!0,d.up=!0);b.currentTool=c;Hg(c,!1,a)}};
Kk.prototype.canShowContextMenu=function(a){var b=this.diagram,c=b.toolManager.findTool("ContextMenu");if(null===c)return!1;void 0===a&&(a=0<b.selection.count?b.selection.first():b);return null===c.findObjectWithContextMenu(a)?!1:!0};
Kk.prototype.computeEffectiveCollection=function(a,b){var c=this.diagram,d=c.toolManager.findTool("Dragging"),e=c.currentTool===d;void 0===b&&(b=e?d.dragOptions:c.on);d=new I;if(null===a)return d;for(var f=a.iterator;f.next();)Cj(c,d,f.value,e,b);if(null!==c.draggedLink&&b.dragsLink)return d;for(f=a.iterator;f.next();)a=f.value,a instanceof T&&(b=a.fromNode,null===b||d.contains(b)?(b=a.toNode,null===b||d.contains(b)||d.remove(a)):d.remove(a));return d};
na.Object.defineProperties(Kk.prototype,{diagram:{get:function(){return this.C}},copiesClipboardData:{get:function(){return this.o},set:function(a){this.o=a}},copiesConnectedLinks:{get:function(){return this.D},set:function(a){this.D=a}},deletesConnectedLinks:{get:function(){return this.Ma},set:function(a){this.Ma=a}},copiesTree:{get:function(){return this.Ba},
set:function(a){this.Ba=a}},deletesTree:{get:function(){return this.Qb},set:function(a){this.Qb=a}},copiesParentKey:{get:function(){return this.wa},set:function(a){this.wa=a}},copiesGroupKey:{get:function(){return this.L},set:function(a){this.L=a}},archetypeGroupData:{get:function(){return this.j},set:function(a){this.j=a}},memberValidation:{get:function(){return this.ki},
set:function(a){this.ki=a}},defaultScale:{get:function(){return this.diagram.defaultScale},set:function(a){this.diagram.defaultScale=a}},zoomFactor:{get:function(){return this.rc},set:function(a){1<a||C("zoomFactor must be larger than 1.0, not: "+a);this.rc=a}},isZoomToFitRestoreEnabled:{get:function(){return this.Gb},set:function(a){this.Gb=a}},scrollToPartPause:{get:function(){return this.Rb},
set:function(a){this.Rb=a}}});Kk.className="CommandHandler";ti=function(){return new Kk};
function Y(){Ua(this);this.G=4225027;this.mb=1;this.bg=null;this.na="";this.jd=this.Ub=null;this.ja=(new J(NaN,NaN)).freeze();this.Uc=Mb;this.Zf=Gb;this.Yf=Lb;this.vb=new nd;this.Nh=new nd;this.Bb=null;this.sa=this.Rk=1;this.zb=0;this.Ee=Ok;this.Ug=oc;this.lc=(new M(NaN,NaN,NaN,NaN)).freeze();this.xb=(new M(NaN,NaN,NaN,NaN)).freeze();this.uc=(new M(0,0,NaN,NaN)).freeze();this.P=this.Po=this.Qo=null;this.wk=this.yb=Tc;this.ap=0;this.bp=1;this.Bg=0;this.Ym=1;this.sp=null;this.gp=-Infinity;this.zl=0;
this.Al=qb;this.Bl=Rf;this.Th="";this.fb=this.O=null;this.Ck=-1;this.Dl=this.$a=this.Sh=this.Hl=null;this.Jr=og;this.ep=this.wg=this.Bj=null}var pd,og,qg,Ok,Pk,Qk,Rk,Sk,Tk,Uk;
Y.prototype.cloneProtected=function(a){a.G=this.G|6144;a.mb=this.mb;a.na=this.na;a.Ub=this.Ub;a.jd=this.jd;a.wg=this.wg;a.ja.assign(this.ja);a.Uc=this.Uc.I();a.Zf=this.Zf.I();a.Yf=this.Yf.I();null!==this.Bb?a.Bb=this.Bb.copy():a.Bb=null;a.sa=this.sa;a.zb=this.zb;a.Ee=this.Ee;a.Ug=this.Ug.I();a.lc.assign(this.lc);a.xb.assign(this.xb);a.uc.assign(this.uc);a.Po=this.Po;null!==this.P&&(a.P=this.P.copy());a.yb=this.yb.I();a.wk=this.wk.I();a.ap=this.ap;a.bp=this.bp;a.Bg=this.Bg;a.Ym=this.Ym;a.sp=this.sp;
a.gp=this.gp;a.zl=this.zl;a.Al=this.Al.I();a.Bl=this.Bl;a.Th=this.Th;null!==this.O&&(a.O=this.O.copy());a.fb=this.fb;a.Ck=this.Ck;null!==this.Sh&&(a.Sh=Ba(this.Sh));null!==this.$a&&(a.$a=this.$a.copy());a.Dl=this.Dl};Y.prototype.sx=function(a){var b=this.Sh;if(Aa(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.Sh=b=[];b.push(a)};Y.prototype.wf=function(a){a.Qo=null;a.Bj=null;a.s()};
Y.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.Sh)for(var b=0;b<this.Sh.length;b++){var c=this.Sh[b];a[c]=this[c]}return a};Y.prototype.copy=function(){return this.clone()};t=Y.prototype;t.gb=function(a){a.classType===T?0===a.name.indexOf("Orient")?this.segmentOrientation=a:C("Unknown Link enum value for GraphObject.segmentOrientation property: "+a):a.classType===Y&&(this.stretch=a)};t.toString=function(){return Ka(this.constructor)+"#"+fb(this)};
function Vk(a){null===a.O&&(a.O=new Wk)}t.Lc=function(){if(null===this.P){var a=new Xk;a.Og=qc;a.th=qc;a.Mg=10;a.rh=10;a.Ng=0;a.sh=0;this.P=a}};
t.Wa=function(a,b,c,d,e,f,g){var h=this.part;if(null!==h&&(h.nk(a,b,c,d,e,f,g),c===this&&a===ge&&Yk(this)&&Zk(this,h,b),f=this.diagram,null===this.wg||null===f||!f.Oi||f.undoManager.isUndoingRedoing||f.animationManager.Tm||(a=this.wg.get(b),null!==a&&f.animationManager.isEnabled&&!f.animationManager.isTicking&&(null===this.ep&&(this.ep=new I),g=0===f.undoManager.transactionLevel,a.startCondition===Xh?g=!0:a.startCondition===Zh&&(g=!1),g?(f=new fh,Yh(a,f),g=this.ep.get(a),null!==g&&g.stop(),this.ep.add(a,
f),f.nu=this,f.kx=a,f.add(this,b,d,e),f.start()):(gh(f.animationManager,"Trigger"),f.animationManager.defaultAnimation.add(this,b,d,e)))),this instanceof X&&c===h&&0!==(h.G&16777216)&&null!==h.data))for(c=this.T.m,d=c.length,e=0;e<d;e++)h=c[e],h instanceof X&&uj(h,function(a){null!==a.data&&0!==(a.G&16777216)&&a.Fa(b)})};
function Zk(a,b,c){var d=a.Ch();if(null!==d)for(var e=a.fb.iterator;e.next();){var f=e.value,g=null;if(null!==f.sourceName){g=$k(f,d,a);if(null===g)continue;f.zq(a,g,c,null)}else if(f.isToModel){var h=b.diagram;null===h||h.skipsModelSourceBindings||f.zq(a,h.model.modelData,c,d)}else{h=d.data;if(null===h)continue;var k=b.diagram;null===k||k.skipsModelSourceBindings||f.zq(a,h,c,d)}g===a&&(h=d.os(f.Xi),null!==h&&f.Vv(h,g,c))}}t.os=function(a){return this.Ck===a?this:null};
t.g=function(a,b,c){this.Wa(ge,a,this,b,c)};t.xe=function(a,b,c,d){var e=this.lc;e.h(a,b,c,d);if(1!==this.sa||0!==this.zb){null===this.Bb&&(this.Bb=new nd);var f=this.Bb;f.reset();this.mp(f,a,b,c,d);f.wq(e)}};function al(a,b,c,d){if(!1===a.pickable)return!1;d.multiply(a.transform);return c?a.Mc(b,d):a.Ah(b,d)}
t.Ox=function(a,b,c){if(!1===this.pickable)return!1;var d=this.naturalBounds;b=a.xf(b);return c?zb(a.x,a.y,0,0,0,d.height)<=b||zb(a.x,a.y,0,d.height,d.width,d.height)<=b||zb(a.x,a.y,d.width,d.height,d.width,0)<=b||zb(a.x,a.y,d.width,0,0,0)<=b:a.qd(0,0)<=b&&a.qd(0,d.height)<=b&&a.qd(d.width,0)<=b&&a.qd(d.width,d.height)<=b};t.je=function(){return!0};
t.$=function(a){var b=J.alloc();b.assign(a);this.transform.Aa(b);var c=this.actualBounds;if(!c.u())return J.free(b),!1;var d=this.diagram;if(null!==d&&d.Mt){var e=d.am("extraTouchThreshold"),f=d.am("extraTouchArea"),g=f/2,h=this.naturalBounds;d=this.Af()*d.scale;var k=1/d;if(h.width*d<e&&h.height*d<e)return a=ac(c.x-g*k,c.y-g*k,c.width+f*k,c.height+f*k,b.x,b.y),J.free(b),a}e=!1;if(this instanceof ye||this instanceof xf?ac(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y):c.$(b))this.$a&&!this.$a.$(b)?e=
!1:null!==this.jd&&c.$(b)?e=!0:null!==this.Ub&&this.uc.$(a)?e=!0:e=this.Bh(a);J.free(b);return e};t.Bh=function(a){var b=this.naturalBounds;return ac(0,0,b.width,b.height,a.x,a.y)};t.Ge=function(a){if(0===this.angle)return this.actualBounds.Ge(a);var b=this.naturalBounds;b=M.allocAt(0,0,b.width,b.height);var c=this.transform,d=!1,e=J.allocAt(a.x,a.y);b.$(c.Hd(e))&&(e.h(a.x,a.bottom),b.$(c.Hd(e))&&(e.h(a.right,a.bottom),b.$(c.Hd(e))&&(e.h(a.right,a.y),b.$(c.Hd(e))&&(d=!0))));J.free(e);M.free(b);return d};
t.Ah=function(a,b){if(void 0===b)return a.Ge(this.actualBounds);var c=this.naturalBounds,d=!1,e=J.allocAt(0,0);a.$(b.Aa(e))&&(e.h(0,c.height),a.$(b.Aa(e))&&(e.h(c.width,c.height),a.$(b.Aa(e))&&(e.h(c.width,0),a.$(b.Aa(e))&&(d=!0))));J.free(e);return d};
t.Mc=function(a,b){if(void 0===b&&(b=this.transform,0===this.angle))return a.Mc(this.actualBounds);var c=this.naturalBounds,d=J.allocAt(0,0),e=J.allocAt(0,c.height),f=J.allocAt(c.width,c.height),g=J.allocAt(c.width,0),h=!1;if(a.$(b.Aa(d))||a.$(b.Aa(e))||a.$(b.Aa(f))||a.$(b.Aa(g)))h=!0;else{c=M.allocAt(0,0,c.width,c.height);var k=J.allocAt(a.x,a.y);c.$(b.Hd(k))?h=!0:(k.h(a.x,a.bottom),c.$(b.Hd(k))?h=!0:(k.h(a.right,a.bottom),c.$(b.Hd(k))?h=!0:(k.h(a.right,a.y),c.$(b.Hd(k))&&(h=!0))));J.free(k);M.free(c);
!h&&(L.ys(a,d,e)||L.ys(a,e,f)||L.ys(a,f,g)||L.ys(a,g,d))&&(h=!0)}J.free(d);J.free(e);J.free(f);J.free(g);return h};t.da=function(a,b){void 0===b&&(b=new J);if(a instanceof N){var c=this.naturalBounds;b.h(a.x*c.width+a.offsetX,a.y*c.height+a.offsetY)}else b.set(a);this.fe.Aa(b);return b};
t.Li=function(a){void 0===a&&(a=new M);var b=this.naturalBounds,c=this.fe,d=J.allocAt(0,0).transform(c);a.h(d.x,d.y,0,0);d.h(b.width,0).transform(c);$b(a,d.x,d.y,0,0);d.h(b.width,b.height).transform(c);$b(a,d.x,d.y,0,0);d.h(0,b.height).transform(c);$b(a,d.x,d.y,0,0);J.free(d);return a};t.Ki=function(){var a=this.fe;1===a.m11&&0===a.m12?a=0:(a=180*Math.atan2(a.m12,a.m11)/Math.PI,0>a&&(a+=360));return a};
t.Af=function(){if(0!==(this.G&4096)===!1)return this.Rk;var a=this.sa;return null!==this.panel?a*this.panel.Af():a};t.us=function(a,b){void 0===b&&(b=new J);b.assign(a);this.fe.Hd(b);return b};t.vs=function(a,b,c){return this.Zj(a.x,a.y,b.x,b.y,c)};
t.Zj=function(a,b,c,d,e){var f=this.transform,g=1/(f.m11*f.m22-f.m12*f.m21),h=f.m22*g,k=-f.m12*g,l=-f.m21*g,m=f.m11*g,n=g*(f.m21*f.dy-f.m22*f.dx),p=g*(f.m12*f.dx-f.m11*f.dy);if(null!==this.areaBackground)return f=this.actualBounds,L.Cf(f.left,f.top,f.right,f.bottom,a,b,c,d,e);g=a*h+b*l+n;a=a*k+b*m+p;b=c*h+d*l+n;c=c*k+d*m+p;e.h(0,0);d=this.naturalBounds;c=L.Cf(0,0,d.width,d.height,g,a,b,c,e);e.transform(f);return c};
Y.prototype.measure=function(a,b,c,d){if(!1!==hj(this)){var e=this.Ug,f=e.right+e.left;e=e.top+e.bottom;a=Math.max(a-f,0);b=Math.max(b-e,0);c=Math.max((c||0)-f,0);d=Math.max((d||0)-e,0);f=this.angle;e=this.desiredSize;var g=0;this instanceof xf&&(g=this.strokeWidth);90===f||270===f?(a=isFinite(e.height)?e.height+g:a,b=isFinite(e.width)?e.width+g:b):(a=isFinite(e.width)?e.width+g:a,b=isFinite(e.height)?e.height+g:b);e=c||0;g=d||0;var h=this instanceof X;switch(bl(this,!0)){case og:g=e=0;h&&(b=a=Infinity);
break;case pd:isFinite(a)&&a>c&&(e=a);isFinite(b)&&b>d&&(g=b);break;case Pk:isFinite(a)&&a>c&&(e=a);g=0;h&&(b=Infinity);break;case Qk:isFinite(b)&&b>d&&(g=b),e=0,h&&(a=Infinity)}h=this.maxSize;var k=this.minSize;e>h.width&&k.width<h.width&&(e=h.width);g>h.height&&k.height<h.height&&(g=h.height);c=Math.max(e/this.scale,k.width);d=Math.max(g/this.scale,k.height);h.width<c&&(c=Math.min(k.width,c));h.height<d&&(d=Math.min(k.height,d));a=Math.min(h.width,a);b=Math.min(h.height,b);a=Math.max(c,a);b=Math.max(d,
b);if(90===f||270===f)f=a,a=b,b=f,f=c,c=d,d=f;this.lc.ea();this.gm(a,b,c,d);this.lc.freeze();this.lc.u()||C("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.lc.toString());cj(this,!1)}};Y.prototype.gm=function(){};Y.prototype.Qi=function(){return!1};
Y.prototype.arrange=function(a,b,c,d,e){this.bl();var f=M.alloc();f.assign(this.xb);this.xb.ea();!1===ij(this)?this.xb.h(a,b,c,d):this.zh(a,b,c,d);this.xb.freeze();void 0===e?this.$a=null:this.$a=e;c=!1;if(void 0!==e)c=!0;else if(e=this.panel,null===e||e.type!==X.TableRow&&e.type!==X.TableColumn||(e=e.panel),null!==e&&(e=e.uc,d=this.measuredBounds,null!==this.areaBackground&&(d=this.xb),c=b+d.height,d=a+d.width,c=!(0<=a+.05&&d<=e.width+.05&&0<=b+.05&&c<=e.height+.05),this instanceof Lg&&(a=this.naturalBounds,
this.vr>a.height||this.sb>a.width)))c=!0;this.G=c?this.G|256:this.G&-257;this.xb.u()||C("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.xb.toString());this.hm(f,this.xb);cl(this,!1);M.free(f)};t=Y.prototype;t.zh=function(){};
function dl(a,b,c,d,e){a.xb.h(b,c,d,e);if(!a.desiredSize.u()){var f=a.lc;c=a.Ug;b=c.right+c.left;var g=c.top+c.bottom;c=f.width+b;f=f.height+g;d+=b;e+=g;b=bl(a,!0);c===d&&f===e&&(b=og);switch(b){case og:if(c>d||f>e)cj(a,!0),a.measure(c>d?d:c,f>e?e:f,0,0);break;case pd:cj(a,!0);a.measure(d,e,0,0);break;case Pk:cj(a,!0);a.measure(d,f,0,0);break;case Qk:cj(a,!0),a.measure(c,e,0,0)}}}
t.hm=function(a,b){var c=this.part;null!==c&&null!==c.diagram&&(c.selectionObject!==this&&c.resizeObject!==this&&c.rotateObject!==this||el(c,!0),this.N(),Tb(a,b)||(c.Gh(),this.Eo(c)))};t.Eo=function(a){null!==this.portId&&(el(a,!0),a instanceof W&&fl(a,this))};
t.oc=function(a,b){if(this.visible){var c=this.opacity;if(0!==c){var d=this instanceof X&&(this.type===X.TableRow||this.type===X.TableColumn),e=this.xb;if(d||0!==e.width&&0!==e.height&&!isNaN(e.x)&&!isNaN(e.y)){var f=1;1!==c&&(f=a.globalAlpha,a.globalAlpha=f*c);if(d){e=this.xb;d=this.uc;var g=this.jd,h=this.Ub;null===g&&null===h||a.Ed();null!==g&&(ci(this,a,g,!0,!0,d,e),g instanceof gl&&g.type===hl?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),a.yf(g)):a.fillRect(e.x,e.y,e.width,e.height));null!==
h&&(ci(this,a,h,!0,!1,d,e),h instanceof gl&&h.type===hl?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),a.yf(h)):a.fillRect(e.x,e.y,e.width,e.height));this.Ei(a,b)}else if(!this.Jx(a,b)){this instanceof T&&this.fk(!1);d=this.transform;g=this.panel;0!==(this.G&4096)===!0&&il(this);var k=this.part;h=!1;var l=0;if(k&&b.Ie("drawShadows")&&(h=k.isShadowed)){var m=k.shadowOffset;l=Math.max(m.y,m.x)*b.scale*b.dc}m=this.Qi();var n;if(!(n=b.nj||!m)){var p=this.naturalBounds;n=this.Nh;var r=n.m11,q=n.m21,u=
n.dx,w=n.m12,v=n.m22,A=n.dy,y,B=y=0;n=y*r+B*q+u;var z=y*w+B*v+A;y=p.width+l;B=0;var E=y*r+B*q+u;y=y*w+B*v+A;B=Math.min(n,E);var K=Math.min(z,y);var O=Math.max(n+0,E)-B;var S=Math.max(z+0,y)-K;n=B;z=K;y=p.width+l;B=p.height+l;E=y*r+B*q+u;y=y*w+B*v+A;B=Math.min(n,E);K=Math.min(z,y);O=Math.max(n+O,E)-B;S=Math.max(z+S,y)-K;n=B;z=K;y=0;B=p.height+l;E=y*r+B*q+u;y=y*w+B*v+A;B=Math.min(n,E);K=Math.min(z,y);O=Math.max(n+O,E)-B;S=Math.max(z+S,y)-K;n=B;z=K;l=b.viewportBounds;p=l.x;r=l.y;n=!(n>l.width+p||p>O+
n||z>l.height+r||r>S+z)}if(n){n=0!==(this.G&256);a.clipInsteadOfFill&&(n=!1);this instanceof Lg&&(a.font=this.font);if(n){z=g.je()?g.naturalBounds:g.actualBounds;null!==this.$a?(p=this.$a,O=p.x,S=p.y,l=p.width,p=p.height):(O=Math.max(e.x,z.x),S=Math.max(e.y,z.y),l=Math.min(e.right,z.right)-O,p=Math.min(e.bottom,z.bottom)-S);if(O>e.width+e.x||e.x>z.width+z.x){1!==c&&(a.globalAlpha=f);return}a.save();a.beginPath();a.rect(O,S,l,p);a.clip()}if(m){if(!k.isVisible()){1!==c&&(a.globalAlpha=f);return}h&&
(z=k.shadowOffset,a.Mv(z.x*b.scale*b.dc,z.y*b.scale*b.dc,k.shadowBlur),jl(a),a.shadowColor=k.shadowColor)}h&&!0===this.shadowVisible?jl(a):h&&!1===this.shadowVisible&&kl(a);k=this.naturalBounds;null!==this.jd&&(a.Ed(),ci(this,a,this.jd,!0,!0,k,e),this.jd instanceof gl&&this.jd.type===hl?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),a.yf(this.jd)):a.fillRect(e.x,e.y,e.width,e.height));a.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);h&&(null!==g&&0!==(g.G&512)||null!==g&&(g.type===X.Auto||g.type===
X.Spot)&&g.pb()!==this)&&null===this.shadowVisible&&kl(a);null!==this.Ub&&(a.Ed(),ll(this,a,k,e));h&&(null!==this.Ub||null!==this.jd||null!==g&&0!==(g.G&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.pb()!==this)?(ml(this,!0),null===this.shadowVisible&&kl(a)):ml(this,!1);this.Ei(a,b);h&&0!==(this.G&512)===!0&&jl(a);m&&h&&kl(a);n&&(a.restore(),a.Ic(this instanceof X));d.Bs()||(b=1/(d.m11*d.m22-d.m12*d.m21),a.transform(d.m22*b,-d.m12*b,-d.m21*b,d.m11*b,b*(d.m21*d.dy-d.m22*d.dx),b*(d.m12*d.dx-
d.m11*d.dy)))}}1!==c&&(a.globalAlpha=f)}}}};function ll(a,b,c,d){var e=a.naturalBounds,f=0,g=0,h=e.width;e=e.height;var k=a.Mw();a instanceof xf&&(e=a.ma.bounds,f=e.x,g=e.y,h=e.width,e=e.height);ci(a,b,a.Ub,!0,!1,c,d);a.Ub instanceof gl&&a.Ub.type===hl?(b.beginPath(),b.rect(f-k/2,g-k/2,h+k,e+k),b.yf(a.Ub)):b.fillRect(f-k/2,g-k/2,h+k,e+k)}t.Jx=function(){return!1};t.Ei=function(){};
function ci(a,b,c,d,e,f,g){if(null!==c){var h=1,k=1;if("string"===typeof c)d?b.fillStyle=c:b.strokeStyle=c;else if(c.type===nl)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{var l=0;a instanceof xf&&(l=a.strokeWidth);h=f.width;k=f.height;e?(h=g.width,k=g.height):d||(h+=l,k+=l);if((f=b instanceof ol)&&c.ne&&(c.type===pl||c.Fk===h&&c.st===k))var m=c.ne;else{var n=0,p=0,r=0,q=0,u=0,w=0;w=u=0;e?(u=g.x,w=g.y):d||(u-=l/2,w-=l/2);n=c.start.x*h+c.start.offsetX;p=c.start.y*k+c.start.offsetY;r=c.end.x*h+
c.end.offsetX;q=c.end.y*k+c.end.offsetY;n+=u;r+=u;p+=w;q+=w;if(c.type===ql)m=b.createLinearGradient(n,p,r,q);else if(c.type===hl)w=isNaN(c.endRadius)?Math.max(h,k)/2:c.endRadius,isNaN(c.startRadius)?(u=0,w=Math.max(h,k)/2):u=c.startRadius,m=b.createRadialGradient(n,p,u,r,q,w);else if(c.type===pl)try{m=b.createPattern(c.pattern,"repeat")}catch(A){m=null}if(c.type!==pl&&(e=c.colorStops,null!==e))for(e=e.iterator;e.next();)m.addColorStop(e.key,e.value);if(f&&(c.ne=m,null!==m&&(c.Fk=h,c.st=k),null===
m&&c.type===pl&&-1!==c.Fk)){c.Fk=-1;var v=a.diagram;null!==v&&-1===c.Fk&&ua(function(){v.redraw()},600)}}d?b.fillStyle=m:b.strokeStyle=m}}}t.rg=function(a){if(a instanceof X)a:{if(this!==a&&null!==a)for(var b=this.panel;null!==b;){if(b===a){a=!0;break a}b=b.panel}a=!1}else a=!1;return a};t.Ff=function(){if(!this.visible)return!1;var a=this.panel;return null!==a?a.Ff():!0};t.Ef=function(){for(var a=this instanceof X?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a};
function il(a){if(0!==(a.G&2048)===!0){var b=a.vb;b.reset();if(!a.xb.u()||!a.lc.u()){rl(a,!1);return}b.translate(a.xb.x-a.lc.x,a.xb.y-a.lc.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;a.mp(b,c.x,c.y,c.width,c.height)}rl(a,!1);sl(a,!0)}0!==(a.G&4096)===!0&&(b=a.panel,null===b?(a.Nh.set(a.vb),a.Rk=a.scale,sl(a,!1)):null!==b.fe&&(c=a.Nh,c.reset(),b.je()?c.multiply(b.Nh):null!==b.panel&&c.multiply(b.panel.Nh),c.multiply(a.vb),a.Rk=a.scale*b.Rk,sl(a,!1)))}
t.mp=function(a,b,c,d,e){1!==this.sa&&a.scale(this.sa);if(0!==this.zb){var f=J.alloc();f.Ui(b,c,d,e,xc);a.rotate(this.zb,f.x,f.y);J.free(f)}};t.s=function(a){if(!hj(this)){void 0===a&&(a=!1);cj(this,!0);cl(this,!0);var b=this.panel;null===b||a||b.s()}};t.ak=function(){hj(this)||(cj(this,!0),cl(this,!0))};function tl(a){if(!ij(a)){var b=a.panel;null!==b?b.s():a.Qi()&&(b=a.diagram,null!==b&&(b.te.add(a),a instanceof W&&a.sd(),b.Fb()));cl(a,!0)}}
t.bl=function(){0!==(this.G&2048)===!1&&(rl(this,!0),sl(this,!0))};t.bv=function(){sl(this,!0)};t.N=function(){var a=this.part;null!==a&&a.N()};
function bl(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===X.Table)return ul(a,d.getRowDefinition(a.row),d.getColumnDefinition(a.column),b);if(null!==d&&d.type===X.Auto&&d.pb()===a)return vl(a,pd,b);if(c===Ok){if(null!==d){if(d.type===X.Spot&&d.pb()===a)return vl(a,pd,b);c=d.defaultStretch;return c===Ok?vl(a,og,b):vl(a,c,b)}return vl(a,og,b)}return vl(a,c,b)}
function ul(a,b,c,d){var e=a.stretch;if(e!==Ok)return vl(a,e,d);var f=e=null;switch(b.stretch){case Qk:f=!0;break;case pd:f=!0}switch(c.stretch){case Pk:e=!0;break;case pd:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===Pk||b===pd);null===f&&(f=b===Qk||b===pd);return!0===e&&!0===f?vl(a,pd,d):!0===e?vl(a,Pk,d):!0===f?vl(a,Qk,d):vl(a,og,d)}
function vl(a,b,c){if(c)return b;if(b===og)return og;c=a.desiredSize;if(c.u())return og;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===Pk)return og;if(b===pd)return Qk}else{if(b===Qk)return og;if(b===pd)return Pk}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===Qk)return og;if(b===pd)return Pk}else{if(b===Pk)return og;if(b===pd)return Qk}return b}function ml(a,b){a.G=b?a.G|512:a.G&-513}function Yk(a){return 0!==(a.G&1024)}function wl(a,b){a.G=b?a.G|1024:a.G&-1025}
function rl(a,b){a.G=b?a.G|2048:a.G&-2049}function sl(a,b){a.G=b?a.G|4096:a.G&-4097}function hj(a){return 0!==(a.G&8192)}function cj(a,b){a.G=b?a.G|8192:a.G&-8193}function ij(a){return 0!==(a.G&16384)}function cl(a,b){a.G=b?a.G|16384:a.G&-16385}t.Si=function(a){this.bg=a};t.Us=function(){};t.Jv=function(a){this.ja=a;tl(this);return!0};t.wm=function(a,b){if(this.ja.x!==a||this.ja.y!==b)this.ja.h(a,b),this.bl()};t.Mw=function(){return 0};
function xl(a){var b=a.part;if(b instanceof W&&(null!==a.portId||a===b.port)){var c=b.diagram;null===c||c.undoManager.isUndoingRedoing||fl(b,a)}}function yl(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof X?a instanceof W?a.sd():a.Cm(a,function(a){xl(a)}):xl(a))}
t.bind=function(a,b,c,d){var e=null;"string"===typeof a?e=new si(a,b,c,d):e=a;e.pd=this;a=this.Ch();null!==a&&zl(a)&&C("Cannot add a Binding to a template that has already been copied: "+e);null===this.fb&&(this.fb=new F);this.fb.add(e);return this};t.set=function(a){Object.assign(this,a);return this};t.wu=function(a){Al(this,a);return this};t.apply=function(a){a(this);return this};t.xm=function(a){oj(this,a);return this};t.Oz=function(){return this.Ch()};
t.Ch=function(){for(var a=this instanceof X?this:this.panel;null!==a;){if(null!==a.Qh)return a;a=a.panel}return null};t.Rv=function(a){a.pd=this;null===this.wg&&(this.wg=new I);this.wg.add(a.propertyName,a);return this};
function Bl(a,b){for(var c=1;c<arguments.length;++c);c=arguments;var d=null,e=null;if("function"===typeof a)e=a;else if("string"===typeof a){var f=Cl.H(a);"function"===typeof f?(c=Ba(arguments),d=f(c),za(d)||C('GraphObject.make invoked object builder "'+a+'", but it did not return an Object')):e=x.go[a]}null===d&&(void 0!==e&&null!==e&&e.constructor||C("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: "+a),d=new e);e=1;if(d instanceof R&&1<c.length){f=
d;var g=c[1];if("string"===typeof g||g instanceof HTMLDivElement)oi(f,g),e++}for(;e<c.length;e++)f=c[e],void 0===f?C("Undefined value at argument "+e+" for object being constructed by GraphObject.make: "+d):Al(d,f);return d}
function Al(a,b){if("string"===typeof b)if(a instanceof Lg)a.text=b;else if(a instanceof xf)a.figure=b;else if(a instanceof Qj)a.source=b;else if(a instanceof X)b=Dl.H(b),null!==b&&(a.type=b);else if(a instanceof gl){var c=Va(gl,b);null!==c?a.type=c:C("Unknown Brush type as an argument to GraphObject.make: "+b)}else a instanceof P?(b=Va(P,b),null!==b&&(a.type=b)):a instanceof ae&&(b=Va(ae,b),null!==b&&(a.type=b));else if(b instanceof Y)a instanceof X||C("A GraphObject can only be added to a Panel, not to: "+
a),a.add(b);else if(b instanceof Ij){var d;b.isRow&&"function"===typeof a.getRowDefinition?d=a.getRowDefinition(b.index):b.isRow||"function"!==typeof a.getColumnDefinition||(d=a.getColumnDefinition(b.index));d instanceof Ij?(a=d,b.isRow?a.height=b.height:a.width=b.width,a.minimum=b.minimum,a.maximum=b.maximum,a.alignment=b.alignment,a.stretch=b.stretch,a.sizing=b.sizing,a.eg=null===b.separatorPadding?null:b.separatorPadding.I(),a.separatorStroke=b.separatorStroke,a.separatorStrokeWidth=b.separatorStrokeWidth,
a.Hj=null,b.separatorDashArray&&(a.Hj=Ba(b.separatorDashArray)),a.background=b.background,a.coversSeparators=b.coversSeparators,a.fb=b.fb):C("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+a)}else if(b instanceof D)"function"===typeof a.gb&&a.gb(b);else if(b instanceof El)a.type=b;else if(b instanceof si)a instanceof Y?a.bind(b):a instanceof Ij?a.bind(b):C("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+
a);else if(b instanceof Vh)a instanceof Y?a.Rv(b):C("An AnimationTrigger can only be applied to a GraphObject, not to: "+a);else if(b instanceof $d)a instanceof P?a.figures.add(b):C("A PathFigure can only be added to a Geometry, not to: "+a);else if(b instanceof ae)a instanceof $d?a.segments.add(b):C("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof mi)a instanceof R?a.layout=b:a instanceof U?a.layout=b:C("A Layout can only be assigned to a Diagram or a Group, not to: "+
a);else if(Array.isArray(b))for(c=0;c<b.length;c++)Al(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof gl){c=new Xa;for(var e in b)d=parseFloat(e),isNaN(d)?c[e]=b[e]:a.addColorStop(d,b[e]);oj(a,c)}else if(a instanceof Ij){void 0!==b.row?(e=b.row,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&C("Must specify non-negative integer row for RowColumnDefinition "+b+", not: "+e),a.isRow=!0,a.index=e):void 0!==b.column&&(e=b.column,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&C("Must specify non-negative integer column for RowColumnDefinition "+
b+", not: "+e),a.isRow=!1,a.index=e);e=new Xa;for(c in b)"row"!==c&&"column"!==c&&(e[c]=b[c]);oj(a,e)}else oj(a,b);else C('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+a)}function Fl(a,b){Cl.add(a,b)}function Gl(a,b,c){void 0===c&&(c=null);var d=a[1];if("function"===typeof c?c(d):"string"===typeof d)return a.splice(1,1),d;if(void 0===b)throw Error("no "+("function"===typeof c?"satisfactory":"string")+" argument for GraphObject builder "+a[0]);return b}
na.Object.defineProperties(Y.prototype,{shadowVisible:{get:function(){return this.Dl},set:function(a){var b=this.Dl;b!==a&&(this.Dl=a,this.N(),this.g("shadowVisible",b,a))}},enabledChanged:{get:function(){return null!==this.O?this.O.un:null},set:function(a){Vk(this);var b=this.O.un;b!==a&&(this.O.un=a,this.g("enabledChanged",b,a))}},segmentOrientation:{get:function(){return this.Bl},set:function(a){var b=this.Bl;
b!==a&&(this.Bl=a,this.s(),this.g("segmentOrientation",b,a),a===Rf&&(this.angle=0))}},segmentIndex:{get:function(){return this.gp},set:function(a){a=Math.round(a);var b=this.gp;b!==a&&(this.gp=a,this.s(),this.g("segmentIndex",b,a))}},segmentFraction:{get:function(){return this.zl},set:function(a){isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.zl;b!==a&&(this.zl=a,this.s(),this.g("segmentFraction",b,a))}},segmentOffset:{
get:function(){return this.Al},set:function(a){var b=this.Al;b.A(a)||(this.Al=a=a.I(),this.s(),this.g("segmentOffset",b,a))}},stretch:{get:function(){return this.Ee},set:function(a){var b=this.Ee;b!==a&&(this.Ee=a,this.s(),this.g("stretch",b,a))}},name:{get:function(){return this.na},set:function(a){var b=this.na;b!==a&&(this.na=a,null!==this.part&&(this.part.li=null),this.g("name",b,a))}},opacity:{get:function(){return this.mb},
set:function(a){var b=this.mb;b!==a&&((0>a||1<a)&&xa(a,"0 <= value <= 1",Y,"opacity"),this.mb=a,this.g("opacity",b,a),a=this.diagram,b=this.part,null!==a&&null!==b&&a.N(sj(b,b.actualBounds)))}},visible:{get:function(){return 0!==(this.G&1)},set:function(a){var b=0!==(this.G&1);b!==a&&(this.G^=1,this.g("visible",b,a),b=this.panel,null!==b?b.s():this.Qi()&&this.Ob(a),this.N(),yl(this))}},pickable:{get:function(){return 0!==(this.G&2)},set:function(a){var b=
0!==(this.G&2);b!==a&&(this.G^=2,this.g("pickable",b,a))}},fromLinkableDuplicates:{get:function(){return 0!==(this.G&4)},set:function(a){var b=0!==(this.G&4);b!==a&&(this.G^=4,this.g("fromLinkableDuplicates",b,a))}},fromLinkableSelfNode:{get:function(){return 0!==(this.G&8)},set:function(a){var b=0!==(this.G&8);b!==a&&(this.G^=8,this.g("fromLinkableSelfNode",b,a))}},toLinkableDuplicates:{get:function(){return 0!==
(this.G&16)},set:function(a){var b=0!==(this.G&16);b!==a&&(this.G^=16,this.g("toLinkableDuplicates",b,a))}},toLinkableSelfNode:{get:function(){return 0!==(this.G&32)},set:function(a){var b=0!==(this.G&32);b!==a&&(this.G^=32,this.g("toLinkableSelfNode",b,a))}},isPanelMain:{get:function(){return 0!==(this.G&64)},set:function(a){var b=0!==(this.G&64);b!==a&&(this.G^=64,this.s(),this.g("isPanelMain",b,a))}},isActionable:{
get:function(){return 0!==(this.G&128)},set:function(a){var b=0!==(this.G&128);b!==a&&(this.G^=128,this.g("isActionable",b,a))}},areaBackground:{get:function(){return this.jd},set:function(a){var b=this.jd;b!==a&&(null!==a&&Hl(a,"GraphObject.areaBackground"),a instanceof gl&&a.freeze(),this.jd=a,this.N(),this.g("areaBackground",b,a))}},background:{get:function(){return this.Ub},set:function(a){var b=this.Ub;b!==a&&(null!==a&&Hl(a,"GraphObject.background"),
a instanceof gl&&a.freeze(),this.Ub=a,this.N(),this.g("background",b,a))}},part:{get:function(){if(this.Qi())return this;if(null!==this.Bj)return this.Bj;var a;for(a=this.panel;a;){if(a instanceof V)return this.Bj=a;a=a.panel}return null}},svg:{get:function(){return this.Zr},set:function(a){this.Zr=a}},panel:{get:function(){return this.bg}},layer:{get:function(){var a=this.part;
return null!==a?a.layer:null}},diagram:{get:function(){var a=this.part;return null!==a?a.diagram:null}},position:{get:function(){return this.ja},set:function(a){var b=a.x,c=a.y,d=this.ja,e=d.x;d=d.y;(e===b||isNaN(e)&&isNaN(b))&&(d===c||isNaN(d)&&isNaN(c))?this.Us():(a=a.copy(),this.Jv(a,e,d)&&this.g("position",new J(e,d),a))}},actualBounds:{get:function(){return this.xb}},scale:{
get:function(){return this.sa},set:function(a){var b=this.sa;b!==a&&(0>=a&&C("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.sa=a,this.s(),this.g("scale",b,a))}},angle:{get:function(){return this.zb},set:function(a){var b=this.zb;b!==a&&(a%=360,0>a&&(a+=360),b!==a&&(this.zb=a,yl(this),this.s(),this.g("angle",b,a)))}},desiredSize:{get:function(){return this.Uc},set:function(a){var b=a.width,c=a.height,d=this.Uc,e=
d.width,f=d.height;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(this.Uc=a=a.I(),this.s(),this instanceof xf&&this.fc(),this.g("desiredSize",d,a),Yk(this)&&(a=this.part,null!==a&&(Zk(this,a,"width"),Zk(this,a,"height"))))}},width:{get:function(){return this.Uc.width},set:function(a){var b=this.Uc.width;b===a||isNaN(b)&&isNaN(a)||(b=this.Uc,this.Uc=a=(new Fb(a,this.Uc.height)).freeze(),this.s(),this instanceof xf&&this.fc(),this.g("desiredSize",b,a),Yk(this)&&
(a=this.part,null!==a&&Zk(this,a,"width")))}},height:{get:function(){return this.Uc.height},set:function(a){var b=this.Uc.height;b===a||isNaN(b)&&isNaN(a)||(b=this.Uc,this.Uc=a=(new Fb(this.Uc.width,a)).freeze(),this.s(),this instanceof xf&&this.fc(),this.g("desiredSize",b,a),Yk(this)&&(a=this.part,null!==a&&Zk(this,a,"height")))}},minSize:{get:function(){return this.Zf},set:function(a){var b=this.Zf;b.A(a)||(a=a.copy(),isNaN(a.width)&&(a.width=
0),isNaN(a.height)&&(a.height=0),a.freeze(),this.Zf=a,this.s(),this.g("minSize",b,a))}},maxSize:{get:function(){return this.Yf},set:function(a){var b=this.Yf;b.A(a)||(a=a.copy(),isNaN(a.width)&&(a.width=Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.Yf=a,this.s(),this.g("maxSize",b,a))}},measuredBounds:{get:function(){return this.lc}},naturalBounds:{get:function(){return this.uc}},margin:{
get:function(){return this.Ug},set:function(a){"number"===typeof a&&(a=new kc(a));var b=this.Ug;b.A(a)||(this.Ug=a=a.I(),this.s(),this.g("margin",b,a))}},transform:{get:function(){0!==(this.G&2048)===!0&&il(this);return this.vb}},fe:{get:function(){0!==(this.G&4096)===!0&&il(this);return this.Nh}},alignment:{get:function(){return this.yb},set:function(a){var b=this.yb;b.A(a)||(a.Ac()&&!a.Mb()&&
C("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+a),this.yb=a=a.I(),tl(this),this.g("alignment",b,a))}},column:{get:function(){return this.Bg},set:function(a){a=Math.round(a);var b=this.Bg;b!==a&&(0>a&&xa(a,">= 0",Y,"column"),this.Bg=a,this.s(),this.g("column",b,a))}},columnSpan:{get:function(){return this.Ym},set:function(a){a=Math.round(a);var b=this.Ym;b!==a&&(1>a&&xa(a,">= 1",Y,"columnSpan"),this.Ym=a,
this.s(),this.g("columnSpan",b,a))}},row:{get:function(){return this.ap},set:function(a){a=Math.round(a);var b=this.ap;b!==a&&(0>a&&xa(a,">= 0",Y,"row"),this.ap=a,this.s(),this.g("row",b,a))}},rowSpan:{get:function(){return this.bp},set:function(a){a=Math.round(a);var b=this.bp;b!==a&&(1>a&&xa(a,">= 1",Y,"rowSpan"),this.bp=a,this.s(),this.g("rowSpan",b,a))}},spanAllocation:{get:function(){return this.sp},set:function(a){var b=
this.sp;b!==a&&(this.sp=a,this.s(),this.g("spanAllocation",b,a))}},alignmentFocus:{get:function(){return this.wk},set:function(a){var b=this.wk;b.A(a)||(this.wk=a=a.I(),this.s(),this.g("alignmentFocus",b,a))}},portId:{get:function(){return this.Po},set:function(a){var b=this.Po;if(b!==a){var c=this.part;null===c||c instanceof W||C("Cannot set portID on a Link: "+a);null!==b&&null!==c&&Il(c,this);this.Po=a;null!==a&&null!==c&&(c.Je=!0,Jl(c,
this));this.g("portId",b,a)}}},toSpot:{get:function(){return null!==this.P?this.P.th:qc},set:function(a){this.Lc();var b=this.P.th;b.A(a)||(a=a.I(),this.P.th=a,this.g("toSpot",b,a),xl(this))}},toEndSegmentLength:{get:function(){return null!==this.P?this.P.rh:10},set:function(a){this.Lc();var b=this.P.rh;b!==a&&(0>a&&xa(a,">= 0",Y,"toEndSegmentLength"),this.P.rh=a,this.g("toEndSegmentLength",b,a),xl(this))}},toShortLength:{
get:function(){return null!==this.P?this.P.sh:0},set:function(a){this.Lc();var b=this.P.sh;b!==a&&(this.P.sh=a,this.g("toShortLength",b,a),xl(this))}},toLinkable:{get:function(){return null!==this.P?this.P.Ap:null},set:function(a){this.Lc();var b=this.P.Ap;b!==a&&(this.P.Ap=a,this.g("toLinkable",b,a))}},toMaxLinks:{get:function(){return null!==this.P?this.P.Bp:Infinity},set:function(a){this.Lc();var b=this.P.Bp;b!==a&&(0>a&&
xa(a,">= 0",Y,"toMaxLinks"),this.P.Bp=a,this.g("toMaxLinks",b,a))}},fromSpot:{get:function(){return null!==this.P?this.P.Og:qc},set:function(a){this.Lc();var b=this.P.Og;b.A(a)||(a=a.I(),this.P.Og=a,this.g("fromSpot",b,a),xl(this))}},fromEndSegmentLength:{get:function(){return null!==this.P?this.P.Mg:10},set:function(a){this.Lc();var b=this.P.Mg;b!==a&&(0>a&&xa(a,">= 0",Y,"fromEndSegmentLength"),this.P.Mg=a,this.g("fromEndSegmentLength",
b,a),xl(this))}},fromShortLength:{get:function(){return null!==this.P?this.P.Ng:0},set:function(a){this.Lc();var b=this.P.Ng;b!==a&&(this.P.Ng=a,this.g("fromShortLength",b,a),xl(this))}},fromLinkable:{get:function(){return null!==this.P?this.P.An:null},set:function(a){this.Lc();var b=this.P.An;b!==a&&(this.P.An=a,this.g("fromLinkable",b,a))}},fromMaxLinks:{get:function(){return null!==this.P?this.P.Bn:Infinity},
set:function(a){this.Lc();var b=this.P.Bn;b!==a&&(0>a&&xa(a,">= 0",Y,"fromMaxLinks"),this.P.Bn=a,this.g("fromMaxLinks",b,a))}},cursor:{get:function(){return this.Th},set:function(a){var b=this.Th;b!==a&&(this.Th=a,this.g("cursor",b,a))}},click:{get:function(){return null!==this.O?this.O.Ag:null},set:function(a){Vk(this);var b=this.O.Ag;b!==a&&(this.O.Ag=a,this.g("click",b,a))}},doubleClick:{get:function(){return null!==
this.O?this.O.Ig:null},set:function(a){Vk(this);var b=this.O.Ig;b!==a&&(this.O.Ig=a,this.g("doubleClick",b,a))}},contextClick:{get:function(){return null!==this.O?this.O.Cg:null},set:function(a){Vk(this);var b=this.O.Cg;b!==a&&(this.O.Cg=a,this.g("contextClick",b,a))}},mouseEnter:{get:function(){return null!==this.O?this.O.Xg:null},set:function(a){Vk(this);var b=this.O.Xg;b!==a&&(this.O.Xg=a,this.g("mouseEnter",b,a))}},mouseLeave:{
get:function(){return null!==this.O?this.O.$g:null},set:function(a){Vk(this);var b=this.O.$g;b!==a&&(this.O.$g=a,this.g("mouseLeave",b,a))}},mouseOver:{get:function(){return null!==this.O?this.O.ah:null},set:function(a){Vk(this);var b=this.O.ah;b!==a&&(this.O.ah=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return null!==this.O?this.O.Zg:null},set:function(a){Vk(this);var b=this.O.Zg;b!==a&&(this.O.Zg=a,this.g("mouseHover",
b,a))}},mouseHold:{get:function(){return null!==this.O?this.O.Yg:null},set:function(a){Vk(this);var b=this.O.Yg;b!==a&&(this.O.Yg=a,this.g("mouseHold",b,a))}},mouseDragEnter:{get:function(){return null!==this.O?this.O.vo:null},set:function(a){Vk(this);var b=this.O.vo;b!==a&&(this.O.vo=a,this.g("mouseDragEnter",b,a))}},mouseDragLeave:{get:function(){return null!==this.O?this.O.wo:null},set:function(a){Vk(this);
var b=this.O.wo;b!==a&&(this.O.wo=a,this.g("mouseDragLeave",b,a))}},mouseDrop:{get:function(){return null!==this.O?this.O.Wg:null},set:function(a){Vk(this);var b=this.O.Wg;b!==a&&(this.O.Wg=a,this.g("mouseDrop",b,a))}},actionDown:{get:function(){return null!==this.O?this.O.Km:null},set:function(a){Vk(this);var b=this.O.Km;b!==a&&(this.O.Km=a,this.g("actionDown",b,a))}},actionMove:{get:function(){return null!==
this.O?this.O.Lm:null},set:function(a){Vk(this);var b=this.O.Lm;b!==a&&(this.O.Lm=a,this.g("actionMove",b,a))}},actionUp:{get:function(){return null!==this.O?this.O.Mm:null},set:function(a){Vk(this);var b=this.O.Mm;b!==a&&(this.O.Mm=a,this.g("actionUp",b,a))}},actionCancel:{get:function(){return null!==this.O?this.O.Jm:null},set:function(a){Vk(this);var b=this.O.Jm;b!==a&&(this.O.Jm=a,this.g("actionCancel",b,a))}},toolTip:{
get:function(){return null!==this.O?this.O.uh:null},set:function(a){Vk(this);var b=this.O.uh;b!==a&&(this.O.uh=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return null!==this.O?this.O.Dg:null},set:function(a){Vk(this);var b=this.O.Dg;b!==a&&(this.O.Dg=a,this.g("contextMenu",b,a))}}});Y.prototype.trigger=Y.prototype.Rv;Y.prototype.findBindingPanel=Y.prototype.Ch;Y.prototype.findTemplateBinder=Y.prototype.Oz;Y.prototype.setProperties=Y.prototype.xm;
Y.prototype.apply=Y.prototype.apply;Y.prototype.attach=Y.prototype.wu;Y.prototype.set=Y.prototype.set;Y.prototype.isEnabledObject=Y.prototype.Ef;Y.prototype.isVisibleObject=Y.prototype.Ff;Y.prototype.isContainedBy=Y.prototype.rg;Y.prototype.getNearestIntersectionPoint=Y.prototype.vs;Y.prototype.getLocalPoint=Y.prototype.us;Y.prototype.getDocumentScale=Y.prototype.Af;Y.prototype.getDocumentAngle=Y.prototype.Ki;Y.prototype.getDocumentBounds=Y.prototype.Li;Y.prototype.getDocumentPoint=Y.prototype.da;
Y.prototype.intersectsRect=Y.prototype.Mc;Y.prototype.containedInRect=Y.prototype.Ah;Y.prototype.containsRect=Y.prototype.Ge;Y.prototype.containsPoint=Y.prototype.$;Y.prototype.raiseChanged=Y.prototype.g;Y.prototype.raiseChangedEvent=Y.prototype.Wa;Y.prototype.addCopyProperty=Y.prototype.sx;var Cl=null;Y.className="GraphObject";Cl=new I;
Fl("Button",function(){function a(a,b){return null!==a.diagram.Zb(a.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a},function(a){return a===b})}var b=Bl(X,X.Auto,{isActionable:!0,enabledChanged:function(a,b){if(a instanceof X){var c=a.Ya("ButtonBorder");null!==c&&(c.fill=b?a._buttonFillNormal:a._buttonFillDisabled)}},cursor:"pointer",_buttonFillNormal:"#F5F5F5",_buttonStrokeNormal:"#BDBDBD",_buttonFillOver:"#E0E0E0",_buttonStrokeOver:"#9E9E9E",_buttonFillPressed:"#BDBDBD",
_buttonStrokePressed:"#9E9E9E",_buttonFillDisabled:"#E5E5E5"},Bl(xf,{name:"ButtonBorder",figure:"RoundedRectangle",spot1:new N(0,0,2.76142374915397,2.761423749153969),spot2:new N(1,1,-2.76142374915397,-2.761423749153969),parameter1:2,parameter2:2,fill:"#F5F5F5",stroke:"#BDBDBD"}));b.mouseEnter=function(a,b){if(b.Ef()&&b instanceof X&&(a=b.Ya("ButtonBorder"),a instanceof xf)){var c=b._buttonFillOver;b._buttonFillNormal=a.fill;a.fill=c;c=b._buttonStrokeOver;b._buttonStrokeNormal=a.stroke;a.stroke=c}};
b.mouseLeave=function(a,b){b.Ef()&&b instanceof X&&(a=b.Ya("ButtonBorder"),a instanceof xf&&(a.fill=b._buttonFillNormal,a.stroke=b._buttonStrokeNormal))};b.actionDown=function(a,b){if(b.Ef()&&b instanceof X&&null!==b._buttonFillPressed&&0===a.button){var c=b.Ya("ButtonBorder");if(c instanceof xf){a=a.diagram;var d=a.skipsUndoManager;a.skipsUndoManager=!0;var g=b._buttonFillPressed;b._buttonFillOver=c.fill;c.fill=g;g=b._buttonStrokePressed;b._buttonStrokeOver=c.stroke;c.stroke=g;a.skipsUndoManager=
d}}};b.actionUp=function(b,d){if(d.Ef()&&d instanceof X&&null!==d._buttonFillPressed&&0===b.button){var c=d.Ya("ButtonBorder");if(c instanceof xf){var f=b.diagram,g=f.skipsUndoManager;f.skipsUndoManager=!0;a(b,d)?(c.fill=d._buttonFillOver,c.stroke=d._buttonStrokeOver):(c.fill=d._buttonFillNormal,c.stroke=d._buttonStrokeNormal);f.skipsUndoManager=g}}};b.actionCancel=function(b,d){if(d.Ef()&&d instanceof X&&null!==d._buttonFillPressed){var c=d.Ya("ButtonBorder");if(c instanceof xf){var f=b.diagram,
g=f.skipsUndoManager;f.skipsUndoManager=!0;a(b,d)?(c.fill=d._buttonFillOver,c.stroke=d._buttonStrokeOver):(c.fill=d._buttonFillNormal,c.stroke=d._buttonStrokeNormal);f.skipsUndoManager=g}}};b.actionMove=function(b,d){if(d.Ef()&&d instanceof X&&null!==d._buttonFillPressed){var c=b.diagram;if(0===c.firstInput.button&&(c.currentTool.standardMouseOver(),a(b,d)&&(b=d.Ya("ButtonBorder"),b instanceof xf))){var f=c.skipsUndoManager;c.skipsUndoManager=!0;var g=d._buttonFillPressed;b.fill!==g&&(b.fill=g);g=
d._buttonStrokePressed;b.stroke!==g&&(b.stroke=g);c.skipsUndoManager=f}}};return b});
Fl("TreeExpanderButton",function(){var a=Bl("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},Bl(xf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Jb},(new si("figure","isTreeExpanded",function(a,c){c=c.panel;return a?c._treeExpandedFigure:c._treeCollapsedFigure})).jq()),{visible:!1},(new si("visible","isTreeLeaf",function(a){return!a})).jq());a.click=function(a,c){c=c.part;c instanceof ye&&(c=c.adornedPart);if(c instanceof W){var b=c.diagram;
if(null!==b){b=b.commandHandler;if(c.isTreeExpanded){if(!b.canCollapseTree(c))return}else if(!b.canExpandTree(c))return;a.handled=!0;c.isTreeExpanded?b.collapseTree(c):b.expandTree(c)}}};return a});
Fl("SubGraphExpanderButton",function(){var a=Bl("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},Bl(xf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Jb},(new si("figure","isSubGraphExpanded",function(a,c){c=c.panel;return a?c._subGraphExpandedFigure:c._subGraphCollapsedFigure})).jq()));a.click=function(a,c){c=c.part;c instanceof ye&&(c=c.adornedPart);if(c instanceof U){var b=c.diagram;if(null!==b){b=b.commandHandler;if(c.isSubGraphExpanded){if(!b.canCollapseSubGraph(c))return}else if(!b.canExpandSubGraph(c))return;
a.handled=!0;c.isSubGraphExpanded?b.collapseSubGraph(c):b.expandSubGraph(c)}}};return a});Fl("ToolTip",function(){return Bl(ye,X.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},Bl(xf,{name:"Border",figure:"RoundedRectangle",parameter1:1,parameter2:1,fill:"#F5F5F5",stroke:"#F0F0F0",spot1:new N(0,0,4,6),spot2:new N(1,1,-4,-4)}))});
Fl("ContextMenu",function(){return Bl(ye,X.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},new si("background","",function(a){return null!==a.adornedPart&&null!==a.placeholder?null:"#F5F5F5"}))});Fl("ContextMenuButton",function(){var a=Bl("Button");a.stretch=Pk;var b=a.Ya("ButtonBorder");b instanceof xf&&(b.figure="Rectangle",b.strokeWidth=0,b.spot1=new N(0,0,2,3),b.spot2=new N(1,1,-2,-2));return a});
Fl("PanelExpanderButton",function(a){var b=Gl(a,"COLLAPSIBLE"),c=Bl("Button",{_buttonExpandedFigure:"M0 0 M0 6 L4 2 8 6 M8 8",_buttonCollapsedFigure:"M0 0 M0 2 L4 6 8 2 M8 8",_buttonFillNormal:"rgba(0, 0, 0, 0)",_buttonStrokeNormal:null,_buttonFillOver:"rgba(0, 0, 0, .2)",_buttonStrokeOver:null,_buttonFillPressed:"rgba(0, 0, 0, .4)",_buttonStrokePressed:null},Bl(xf,{name:"ButtonIcon",strokeWidth:2},(new si("geometryString","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).jq(b)));
a=c.Ya("ButtonBorder");a instanceof xf&&(a.stroke=null,a.fill="rgba(0, 0, 0, 0)");c.click=function(a,c){var d=c.diagram;if(null!==d&&!d.isReadOnly){var e=c.Ch();null===e&&(e=c.part);null!==e&&(c=e.Ya(b),null!==c&&(a.handled=!0,d.xa("Collapse/Expand Panel"),c.visible=!c.visible,d.Xa("Collapse/Expand Panel")))}};return c});
Fl("CheckBoxButton",function(a){var b=Gl(a);a=Bl("Button",{desiredSize:new Fb(14,14)},Bl(xf,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:pd,geometryStretch:qg,visible:!1},""!==b?(new si("visible",b)).hy():[]));a.click=function(a,d){if(d instanceof X){var c=a.diagram;if(!(null===c||c.isReadOnly||""!==b&&c.model.isReadOnly)){a.handled=!0;var f=d.Ya("ButtonIcon");c.xa("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a,
d);c.Xa("checkbox")}}};return a});
Fl("CheckBox",function(a){a=Gl(a);a=Bl("CheckBoxButton",a,{name:"Button",isActionable:!1,margin:new kc(0,1,0,0)});var b=Bl(X,"Horizontal",a,{isActionable:!0,cursor:a.cursor,margin:1,_buttonFillNormal:a._buttonFillNormal,_buttonStrokeNormal:a._buttonStrokeNormal,_buttonFillOver:a._buttonFillOver,_buttonStrokeOver:a._buttonStrokeOver,_buttonFillPressed:a._buttonFillPressed,_buttonStrokePressed:a._buttonStrokePressed,_buttonFillDisabled:a._buttonFillDisabled,mouseEnter:a.mouseEnter,mouseLeave:a.mouseLeave,
actionDown:a.actionDown,actionUp:a.actionUp,actionCancel:a.actionCancel,actionMove:a.actionMove,click:a.click,_buttonClick:a.click});a.mouseEnter=null;a.mouseLeave=null;a.actionDown=null;a.actionUp=null;a.actionCancel=null;a.actionMove=null;a.click=null;return b});Y.None=og=new D(Y,"None",0);Y.Default=Ok=new D(Y,"Default",0);Y.Vertical=Qk=new D(Y,"Vertical",4);Y.Horizontal=Pk=new D(Y,"Horizontal",5);Y.Fill=pd=new D(Y,"Fill",3);Y.Uniform=qg=new D(Y,"Uniform",1);
Y.UniformToFill=Rk=new D(Y,"UniformToFill",2);Y.FlipVertical=Sk=new D(Y,"FlipVertical",1);Y.FlipHorizontal=Tk=new D(Y,"FlipHorizontal",2);Y.FlipBoth=Uk=new D(Y,"FlipBoth",3);Y.make=Bl;Y.getBuilders=function(){var a=new I,b;for(b in Cl)if(b!==b.toLowerCase()){var c=Cl.H(b);"function"===typeof c&&a.add(b,c)}a.freeze();return a};Y.defineBuilder=Fl;Y.takeBuilderArgument=Gl;
function Wk(){this.un=this.Dg=this.uh=this.Jm=this.Mm=this.Lm=this.Km=this.Wg=this.wo=this.vo=this.Yg=this.Zg=this.ah=this.$g=this.Xg=this.Cg=this.Ig=this.Ag=null}Wk.prototype.copy=function(){var a=new Wk;a.Ag=this.Ag;a.Ig=this.Ig;a.Cg=this.Cg;a.Xg=this.Xg;a.$g=this.$g;a.ah=this.ah;a.Zg=this.Zg;a.Yg=this.Yg;a.vo=this.vo;a.wo=this.wo;a.Wg=this.Wg;a.Km=this.Km;a.Lm=this.Lm;a.Mm=this.Mm;a.Jm=this.Jm;a.uh=this.uh;a.Dg=this.Dg;a.un=this.un;return a};Wk.className="GraphObjectEventHandlers";
function Kl(){this.Na=[1,0,0,1,0,0]}Kl.prototype.copy=function(){var a=new Kl;a.Na[0]=this.Na[0];a.Na[1]=this.Na[1];a.Na[2]=this.Na[2];a.Na[3]=this.Na[3];a.Na[4]=this.Na[4];a.Na[5]=this.Na[5];return a};Kl.prototype.translate=function(a,b){this.Na[4]+=this.Na[0]*a+this.Na[2]*b;this.Na[5]+=this.Na[1]*a+this.Na[3]*b};Kl.prototype.scale=function(a,b){this.Na[0]*=a;this.Na[1]*=a;this.Na[2]*=b;this.Na[3]*=b};Kl.className="STransform";
function Ll(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.Bx=[];this.pattern=null}Ll.prototype.addColorStop=function(a,b){this.Bx.push({offset:a,color:b})};Ll.className="SGradient";
function rj(a,b){this.ownerDocument=a=void 0===b?x.document:b;this.yA="http://www.w3.org/2000/svg";void 0!==a&&(this.La=this.Pb("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.La.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.La.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"));this.Tp=null;this.context=new Ml(this)}
rj.prototype.resize=function(a,b,c,d){return this.width!==a||this.height!==b?(this.style.width=c+"px",this.style.height=d+"px",this.La.setAttributeNS(null,"width",c+"px"),this.La.setAttributeNS(null,"height",d+"px"),this.La.setAttributeNS(null,"viewBox","0 0 "+c+" "+d),this.context.Tw.firstElementChild.setAttributeNS(null,"width",c+"px"),this.context.Tw.firstElementChild.setAttributeNS(null,"height",d+"px"),!0):!1};
rj.prototype.Pb=function(a,b,c){a=this.ownerDocument.createElementNS(this.yA,a);if(za(b))for(var d in b)a.setAttributeNS("href"===d?"http://www.w3.org/1999/xlink":"",d,b[d]);void 0!==c&&(a.textContent=c);return a};rj.prototype.getBoundingClientRect=function(){return this.La.getBoundingClientRect()};rj.prototype.focus=function(){this.La.focus()};rj.prototype.Ix=function(){this.ownerDocument=null};
na.Object.defineProperties(rj.prototype,{width:{get:function(){return this.La.width.baseVal.value},set:function(a){this.La.width=a}},height:{get:function(){return this.La.height.baseVal.value},set:function(a){this.La.height=a}},style:{get:function(){return this.La.style}}});rj.className="SVGSurface";
function Ml(a){this.Ws=a;this.svg=a.La;this.stack=[];this.gd=[];this.fillStyle="#000000";this.font="10px sans-serif";this.globalAlpha=1;this.lineCap="butt";this.lineDashOffset=0;this.lineJoin="miter";this.lineWidth=1;this.miterLimit=10;this.shadowBlur=0;this.shadowColor="rgba(0, 0, 0, 0)";this.shadowOffsetY=this.shadowOffsetX=0;this.strokeStyle="#000000";this.textAlign="start";this.clipInsteadOfFill=!1;this.gg=this.Sr=this.Rr=0;this.Es=null;this.path=[];this.Ht=!1;this.mh=null;this.nh=0;this.He=new Kl;
Nl(this,1,0,0,1,0,0);var b=lb++,c=this.Pb("clipPath",{id:"mainClip"+b});c.appendChild(this.Pb("rect",{x:0,y:0,width:a.width,height:a.height}));this.Tw=c;this.Ws.La.appendChild(c);this.gd[0].setAttributeNS(null,"clip-path","url(#mainClip"+b+")");this.AA={}}t=Ml.prototype;
t.arc=function(a,b,c,d,e,f,g,h){var k=2*Math.PI,l=k-1E-6,m=c*Math.cos(d),n=c*Math.sin(d),p=a+m,r=b+n,q=f?0:1;d=f?d-e:e-d;(1E-6<Math.abs(g-p)||1E-6<Math.abs(h-r))&&this.path.push(["L",p,+r]);0>d&&(d=d%k+k);d>l?(this.path.push(["A",c,c,0,1,q,a-m,b-n]),this.path.push(["A",c,c,0,1,q,p,r])):1E-6<d&&this.path.push(["A",c,c,0,+(d>=Math.PI),q,a+c*Math.cos(e),b+c*Math.sin(e)])};t.beginPath=function(){this.path=[]};t.bezierCurveTo=function(a,b,c,d,e,f){this.path.push(["C",a,b,c,d,e,f])};t.clearRect=function(){};
t.clip=function(){this.addPath("clipPath",this.path,this.He)};t.closePath=function(){this.path.push(["z"])};t.createLinearGradient=function(a,b,c,d){var e=new Ll("linear");e.x1=a;e.y1=b;e.x2=c;e.y2=d;return e};
t.createPattern=function(a){var b="";a instanceof HTMLCanvasElement&&(b=a.toDataURL());a instanceof HTMLImageElement&&(b=a.getAttribute("src"));var c=this.AA;if(c[b])return"url(#"+c[b]+")";var d="PATTERN"+lb++,e={x:0,y:0,width:a.width,height:a.height,href:b};a=this.Pb("pattern",{width:a.width,height:a.height,id:d,patternUnits:"userSpaceOnUse"});a.appendChild(this.Pb(tk,e));this.svg.appendChild(a);c[b]=d;return"url(#"+d+")"};
t.createRadialGradient=function(a,b,c,d,e,f){var g=new Ll("radial");g.x1=a;g.y1=b;g.r1=c;g.x2=d;g.y2=e;g.r2=f;return g};
t.drawImage=function(a,b,c,d,e,f,g,h,k){var l="";a instanceof HTMLCanvasElement&&(l=a.toDataURL());a instanceof HTMLImageElement&&(l=a.getAttribute("src"));var m=a instanceof HTMLImageElement?a.naturalWidth:a.width,n=a instanceof HTMLImageElement?a.naturalHeight:a.height;void 0===d&&(f=b,g=c,h=d=m,k=e=n);d=d||0;e=e||0;f=f||0;g=g||0;h=h||0;k=k||0;a={x:0,y:0,width:m||d,height:n||e,href:l};L.aa(d,h)&&L.aa(e,k)?-1===l.toLowerCase().indexOf(".svg")&&-1===l.toLowerCase().indexOf("data:image/svg")&&(a.preserveAspectRatio=
"xMidYMid slice"):a.preserveAspectRatio="none";l="";h/=d;k/=e;if(0!==f||0!==g)l+=" translate("+f+", "+g+")";if(1!==h||1!==k)l+=" scale("+h+", "+k+")";if(0!==b||0!==c)l+=" translate("+-b+", "+-c+")";if(0!==b||0!==c||d!==m||e!==n)f="CLIP"+lb++,g=this.Pb("clipPath",{id:f}),g.appendChild(this.Pb("rect",{x:b,y:c,width:d,height:e})),this.svg.appendChild(g),a["clip-path"]="url(#"+f+")";Ol(this,tk,a,this.He,l);this.addElement(tk,a)};t.fill=function(){this.addPath("fill",this.path,this.He)};
t.yf=function(){this.clipInsteadOfFill?this.clip():this.fill()};t.fillRect=function(a,b,c,d){a=[a,b,c,d];a={x:a[0],y:a[1],width:a[2],height:a[3]};Ol(this,"fill",a,this.He);this.addElement("rect",a)};t.fillText=function(a,b,c){a=[a,b,c];b=this.textAlign;"left"===b?b="start":"right"===b?b="end":"center"===b&&(b="middle");b={x:a[1],y:a[2],style:"font: "+this.font,"text-anchor":b};Ol(this,"fill",b,this.He);this.addElement("text",b,a[0])};t.lineTo=function(a,b){this.path.push(["L",a,b])};
t.moveTo=function(a,b){this.path.push(["M",a,b])};t.quadraticCurveTo=function(a,b,c,d){this.path.push(["Q",a,b,c,d])};t.rect=function(a,b,c,d){this.path.push(["M",a,b],["L",a+c,b],["L",a+c,b+d],["L",a,b+d],["z"])};
t.restore=function(){this.He=this.stack.pop();this.path=this.stack.pop();var a=this.stack.pop();this.fillStyle=a.fillStyle;this.font=a.font;this.globalAlpha=a.globalAlpha;this.lineCap=a.lineCap;this.lineDashOffset=a.lineDashOffset;this.lineJoin=a.lineJoin;this.lineWidth=a.lineWidth;this.miterLimit=a.miterLimit;this.shadowBlur=a.shadowBlur;this.shadowColor=a.shadowColor;this.shadowOffsetX=a.shadowOffsetX;this.shadowOffsetY=a.shadowOffsetY;this.strokeStyle=a.strokeStyle;this.textAlign=a.textAlign};
t.save=function(){this.stack.push({fillStyle:this.fillStyle,font:this.font,globalAlpha:this.globalAlpha,lineCap:this.lineCap,lineDashOffset:this.lineDashOffset,lineJoin:this.lineJoin,lineWidth:this.lineWidth,miterLimit:this.miterLimit,shadowBlur:this.shadowBlur,shadowColor:this.shadowColor,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,strokeStyle:this.strokeStyle,textAlign:this.textAlign});for(var a=[],b=0;b<this.path.length;b++)a.push(this.path[b]);this.stack.push(a);this.stack.push(this.He.copy())};
t.setTransform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||Nl(this,a,b,c,d,e,f)};t.scale=function(a,b){this.He.scale(a,b)};t.translate=function(a,b){this.He.translate(a,b)};t.transform=function(){};t.Ed=function(){};t.stroke=function(){this.addPath("stroke",this.path,this.He)};t.Wi=function(){this.clipInsteadOfFill||this.stroke()};t.Pb=function(a,b,c){return this.Ws.Pb(a,b,c)};
t.addElement=function(a,b,c){a=this.Pb(a,b,c);0<this.gd.length?this.gd[this.gd.length-1].appendChild(a):this.svg.appendChild(a);return this.Es=a};
function Ol(a,b,c,d,e){1!==a.globalAlpha&&(c.opacity=a.globalAlpha);"fill"===b?(a.fillStyle instanceof Ll?c.fill=Pl(a,a.fillStyle):/^rgba\(/.test(a.fillStyle)?(a=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.fillStyle),c.fill="rgb("+a[1]+","+a[2]+","+a[3]+")",c["fill-opacity"]=a[4]):c.fill=a.fillStyle,c.stroke="none"):"stroke"===b&&(c.fill="none",a.strokeStyle instanceof Ll?c.stroke=Pl(a,a.strokeStyle):/^rgba\(/.test(a.strokeStyle)?(b=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.strokeStyle),
c.stroke="rgb("+b[1]+","+b[2]+","+b[3]+")",c["stroke-opacity"]=b[4]):c.stroke=a.strokeStyle,c["stroke-width"]=a.lineWidth,c["stroke-linecap"]=a.lineCap,c["stroke-linejoin"]=a.lineJoin,c["stroke-miterlimit"]=a.miterLimit);d=d.Na;d="matrix("+d[0]+", "+d[1]+", "+d[2]+", "+d[3]+", "+d[4]+", "+d[5]+")";void 0!==e&&(d+=e);c.transform=d}
function Pl(a,b){var c="GRAD"+lb++;if("linear"===b.type)var d=a.Pb("linearGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,id:c,gradientUnits:"userSpaceOnUse"});else if("radial"===b.type)d=a.Pb("radialGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,r1:b.r1,r2:b.r2,id:c});else throw Error("invalid gradient");var e=b.Bx;b=e.length;for(var f=[],g=0;g<b;g++){var h=e[g],k=h.color;h={offset:h.offset,"stop-color":k};/^rgba\(/.test(k)&&(k=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(k),
h["stop-color"]="rgb("+k[1]+","+k[2]+","+k[3]+")",h["stop-opacity"]=k[4]);f.push(h)}f.sort(function(a,b){return a.offset>b.offset?1:-1});for(e=0;e<b;e++)d.appendChild(a.Pb("stop",f[e]));a.svg.appendChild(d);return"url(#"+c+")"}
t.addPath=function(a,b,c){for(var d=[],e=0;e<b.length;e++){var f=Ba(b[e]),g=[f.shift()];if("A"===g[0])g.push(f.shift()+","+f.shift(),f.shift(),f.shift()+","+f.shift(),f.shift()+","+f.shift());else for(;f.length;)g.push(f.shift()+","+f.shift());d.push(g.join(" "))}b={d:d.join(" ")};"stroke"===a&&this.Ht&&(b["stroke-dasharray"]=this.mh.toString(),b["stroke-dashoffset"]=this.nh);Ol(this,a,b,c);"clipPath"===a?(a="CLIP"+lb++,c=this.Pb("clipPath",{id:a}),c.appendChild(this.Pb("path",b)),this.svg.appendChild(c),
0<this.gd.length&&this.gd[this.gd.length-1].setAttributeNS(null,"clip-path","url(#"+a+")")):this.addElement("path",b)};function Nl(a,b,c,d,e,f,g){var h=new Kl;h.Na=[b,c,d,e,f,g];b={};Ol(a,"g",b,h);h=a.addElement("g",b);a.gd.push(h)}
t.zm=function(a){if(0!==this.shadowOffsetX||0!==this.shadowOffsetY||0!==this.shadowBlur){var b="SHADOW"+lb++,c=this.addElement("filter",{id:b,x:"-100%",y:"-100%",width:"300%",height:"300%"},null),d=a.computePixelRatio();a=this.Pb("feGaussianBlur",{"in":"SourceAlpha",result:"blur",stdDeviation:this.shadowBlur/2/d});var e=this.Pb("feFlood",{"in":"blur",result:"flood","flood-color":this.shadowColor}),f=this.Pb("feComposite",{"in":"flood",in2:"blur",operator:"in",result:"comp"});d=this.Pb("feOffset",
{"in":"comp",result:"offsetBlur",dx:this.shadowOffsetX/d,dy:this.shadowOffsetY/d});var g=this.Pb("feMerge",{});g.appendChild(this.Pb("feMergeNode",{"in":"offsetBlur"}));g.appendChild(this.Pb("feMergeNode",{"in":"SourceGraphic"}));c.appendChild(a);c.appendChild(e);c.appendChild(f);c.appendChild(d);c.appendChild(g);0<this.gd.length&&this.gd[this.gd.length-1].setAttributeNS(null,"filter","url(#"+b+")")}};t.Mv=function(a,b,c){this.Rr=a;this.Sr=b;this.gg=c};
function kl(a){a.shadowOffsetX=0;a.shadowOffsetY=0;a.shadowBlur=0}function jl(a){a.shadowOffsetX=a.Rr;a.shadowOffsetY=a.Sr;a.shadowBlur=a.gg}t.ns=function(a,b){this.Ht=!0;this.mh=a;this.nh=b};t.ls=function(){this.Ht=!1};t.Ic=function(){};t.vy=function(){};Ml.prototype.rotate=function(){};Ml.prototype.getImageData=function(){return null};Ml.prototype.measureText=function(){return null};Ml.className="SVGContext";
R.prototype.Is=function(a){var b=new rj(this,x.document);void 0===a&&(a=new Xa);var c=this;return rk(this,function(a,e){a=sk(c,a,"SVG",b);a=null!==a?a.svg:null;return"function"===typeof e?(e(a),null):a},a)};R.prototype.makeSvg=R.prototype.Is;R.prototype.kv=function(a){return this.Is(a)};R.prototype.makeSVG=R.prototype.kv;
Y.prototype.Jx=function(a,b){if(!(a instanceof Ml))return!1;var c=null,d=a.Es,e=this.transform,f=this.panel;0!==(this.G&4096)===!0&&il(this);var g=this.xb,h=0!==(this.G&256);a.clipInsteadOfFill&&(h=!1);var k=!1;this instanceof Lg&&(a.font=this.font);if(h){k=f.je()?f.naturalBounds:f.actualBounds;if(null!==this.$a){var l=this.$a;var m=l.x;var n=l.y;var p=l.width;l=l.height}else m=Math.max(g.x,k.x),n=Math.max(g.y,k.y),p=Math.min(g.right,k.right)-m,l=Math.min(g.bottom,k.bottom)-n;if(m>g.width+g.x||g.x>
k.width+k.x||n>g.height+g.y||g.y>k.height+k.y)return!0;k=!0;Nl(a,1,0,0,1,0,0);a.save();a.beginPath();a.rect(m,n,p,l);a.clip()}if(this.Qi()&&!this.isVisible())return!0;a.He.Na=[1,0,0,1,0,0];(this instanceof Lg&&1<this.lineCount||this instanceof xf&&1<this.geometry.figures.length)&&Nl(a,1,0,0,1,0,0);m=!1;this.Qi()&&this.isShadowed&&b.Ie("drawShadows")&&(n=this.shadowOffset,a.Mv(n.x*b.scale*b.dc,n.y*b.scale*b.dc,this.shadowBlur),jl(a),a.shadowColor=this.shadowColor);n=!1;this.part&&b.Ie("drawShadows")&&
(n=this.part.isShadowed);a.clipInsteadOfFill&&(n=!1);!0===this.shadowVisible?(jl(a),!1===m&&n&&(Nl(a,1,0,0,1,0,0),a.zm(b),m=!0)):!1===this.shadowVisible&&kl(a);p=this.naturalBounds;null!==this.areaBackground&&(ci(this,a,this.areaBackground,!0,!0,p,g),!1===m&&n&&(Nl(a,1,0,0,1,0,0),a.zm(b),m=!0),this.areaBackground instanceof gl&&this.areaBackground.type===hl?(a.beginPath(),a.rect(g.x,g.y,g.width,g.height),a.yf(this.areaBackground)):a.fillRect(g.x,g.y,g.width,g.height));l=!1;this instanceof X?Nl(a,
e.m11,e.m12,e.m21,e.m22,e.dx,e.dy):(a.He.Na=[e.m11,e.m12,e.m21,e.m22,e.dx,e.dy],!1===m&&n&&(l=!0));null!==this.background&&(!1===m&&n&&(Nl(a,1,0,0,1,0,0),a.zm(b),m=!0),ll(this,a,p,g));n&&(null!==this.background||null!==this.areaBackground||null!==f&&0!==(f.G&512)||null!==f&&(f.type===X.Auto||f.type===X.Spot)&&f.pb()!==this)?(ml(this,!0),null===this.shadowVisible&&kl(a),l=!1):ml(this,!1);l&&!1===m&&(Nl(a,1,0,0,1,0,0),a.zm(b),m=!0);this.Ei(a,b);n&&0!==(this.G&512)===!0&&jl(a);this.Qi()&&n&&kl(a);h&&
(a.restore(),k&&a.gd.pop());this instanceof X&&(c=a.gd.pop());!0===m&&a.gd.pop();if(this instanceof Lg&&1<this.lineCount||this instanceof xf&&1<this.geometry.figures.length)c=a.gd.pop();null!==a.Ws.Tp&&(null===c&&(d===a.Es?(Nl(a,1,0,0,1,0,0),c=a.gd.pop()):c=a.Es),a.Ws.Tp(this,c));this.svg=c;return!0};
function uk(a,b){this.ownerDocument=b=void 0===b?x.document:b;this.Tp=null;b=b.createElement("canvas");b.tabIndex=0;this.La=b;this.La.innerHTML="This text is displayed if your browser does not support the Canvas HTML element.";this.context=new ol(b);b.C=a}uk.prototype.resize=function(a,b,c,d){return this.width!==a||this.height!==b?(this.width=a,this.height=b,this.style.width=c+"px",this.style.height=d+"px",!0):!1};uk.prototype.toDataURL=function(a,b){return this.La.toDataURL(a,b)};
uk.prototype.getBoundingClientRect=function(){return this.La.getBoundingClientRect()};uk.prototype.focus=function(){this.La.focus()};uk.prototype.Ix=function(){this.ownerDocument=this.La.C=null};na.Object.defineProperties(uk.prototype,{width:{get:function(){return this.La.width},set:function(a){this.La.width=a}},height:{get:function(){return this.La.height},set:function(a){this.La.height=a}},style:{get:function(){return this.La.style}}});
uk.className="CanvasSurface";function ol(a){a.getContext&&a.getContext("2d")||C("Browser does not support HTML Canvas Element");this.Y=a.getContext("2d");this.pt=this.rt=this.qt="";this.Xm=!1;this.gg=this.Sr=this.Rr=0;this.Ul=new nd}t=ol.prototype;t.vy=function(a){this.Y.imageSmoothingEnabled=a};t.arc=function(a,b,c,d,e,f){this.Y.arc(a,b,c,d,e,f)};t.beginPath=function(){this.Y.beginPath()};t.bezierCurveTo=function(a,b,c,d,e,f){this.Y.bezierCurveTo(a,b,c,d,e,f)};
t.clearRect=function(a,b,c,d){this.Ed();this.Y.clearRect(a,b,c,d)};t.clip=function(){this.Y.clip()};t.closePath=function(){this.Y.closePath()};t.createLinearGradient=function(a,b,c,d){return this.Y.createLinearGradient(a,b,c,d)};t.createPattern=function(a,b){return this.Y.createPattern(a,b)};t.createRadialGradient=function(a,b,c,d,e,f){return this.Y.createRadialGradient(a,b,c,d,e,f)};t.drawImage=function(a,b,c,d,e,f,g,h,k){void 0===d?this.Y.drawImage(a,b,c):this.Y.drawImage(a,b,c,d,e,f,g,h,k)};
t.fill=function(){this.Y.fill()};t.fillRect=function(a,b,c,d){this.Y.fillRect(a,b,c,d)};t.fillText=function(a,b,c){this.Y.fillText(a,b,c)};t.getImageData=function(a,b,c,d){return this.Y.getImageData(a,b,c,d)};t.lineTo=function(a,b){this.Y.lineTo(a,b)};t.measureText=function(a){return this.Y.measureText(a)};t.moveTo=function(a,b){this.Y.moveTo(a,b)};t.quadraticCurveTo=function(a,b,c,d){this.Y.quadraticCurveTo(a,b,c,d)};t.rect=function(a,b,c,d){this.Y.rect(a,b,c,d)};t.restore=function(){this.Y.restore()};
t.save=function(){this.Ed();this.Y.save()};ol.prototype.rotate=function(a){this.Ul.rotate(57.2958*a,0,0)};t=ol.prototype;t.setTransform=function(a,b,c,d,e,f){this.Ul.setTransform(a,b,c,d,e,f)};t.scale=function(a,b){this.Ul.scale(a,b)};t.translate=function(a,b){this.Ul.translate(a,b)};t.stroke=function(){this.Y.stroke()};
t.transform=function(a,b,c,d,e,f){if(1!==a||0!==b||0!==c||1!==d||0!==e||0!==f){var g=this.Ul,h=g.m11*a+g.m21*b;a=g.m12*a+g.m22*b;b=g.m11*c+g.m21*d;c=g.m12*c+g.m22*d;g.dx=g.m11*e+g.m21*f+g.dx;g.dy=g.m12*e+g.m22*f+g.dy;g.m11=h;g.m12=a;g.m21=b;g.m22=c}};t.Ed=function(){var a=this.Ul;this.Y.setTransform(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy)};
t.yf=function(a){if(a instanceof gl&&a.type===hl){var b=a.Fk;a=a.st;a>b?(this.scale(b/a,1),this.translate((a-b)/2,0)):b>a&&(this.scale(1,a/b),this.translate(0,(b-a)/2));this.Xm?this.clip():this.fill();a>b?(this.translate(-(a-b)/2,0),this.scale(1/(b/a),1)):b>a&&(this.translate(0,-(b-a)/2),this.scale(1,1/(a/b)))}else this.Xm?this.clip():this.fill()};t.Wi=function(){this.Xm||this.stroke()};t.Mv=function(a,b,c){this.Rr=a;this.Sr=b;this.gg=c};
t.ns=function(a,b){var c=this.Y;void 0!==c.setLineDash&&(c.setLineDash(a),c.lineDashOffset=b)};t.ls=function(){var a=this.Y;void 0!==a.setLineDash&&(a.setLineDash(Ql),a.lineDashOffset=0)};t.Ic=function(a){a&&(this.qt="");this.pt=this.rt=""};
na.Object.defineProperties(ol.prototype,{fillStyle:{get:function(){return this.Y.fillStyle},set:function(a){this.pt!==a&&(this.pt=this.Y.fillStyle=a)}},font:{get:function(){return this.Y.font},set:function(a){this.qt!==a&&(this.qt=this.Y.font=a)}},globalAlpha:{get:function(){return this.Y.globalAlpha},set:function(a){this.Y.globalAlpha=a}},lineCap:{get:function(){return this.Y.lineCap},
set:function(a){this.Y.lineCap=a}},lineDashOffset:{get:function(){return this.Y.lineDashOffset},set:function(a){this.Y.lineDashOffset=a}},lineJoin:{get:function(){return this.Y.lineJoin},set:function(a){this.Y.lineJoin=a}},lineWidth:{get:function(){return this.Y.lineWidth},set:function(a){this.Y.lineWidth=a}},miterLimit:{get:function(){return this.Y.miterLimit},set:function(a){this.Y.miterLimit=
a}},shadowBlur:{get:function(){return this.Y.shadowBlur},set:function(a){this.Y.shadowBlur=a}},shadowColor:{get:function(){return this.Y.shadowColor},set:function(a){this.Y.shadowColor=a}},shadowOffsetX:{get:function(){return this.Y.shadowOffsetX},set:function(a){this.Y.shadowOffsetX=a}},shadowOffsetY:{get:function(){return this.Y.shadowOffsetY},set:function(a){this.Y.shadowOffsetY=
a}},strokeStyle:{get:function(){return this.Y.strokeStyle},set:function(a){this.rt!==a&&(this.rt=this.Y.strokeStyle=a)}},textAlign:{get:function(){return this.Y.textAlign},set:function(a){this.Y.textAlign=a}},imageSmoothingEnabled:{get:function(){return this.Y.imageSmoothingEnabled},set:function(a){this.Y.imageSmoothingEnabled=a}},clipInsteadOfFill:{get:function(){return this.Xm},
set:function(a){this.Xm=a}}});var Ql=Object.freeze([]);ol.className="CanvasSurfaceContext";function Rl(){this.L=this.o=this.D=this.j=0}Rl.className="ColorNumbers";function gl(a,b){Sl||(Tl(),Sl=!0);Ua(this);this.v=!1;void 0===a?(this.ha=nl,this.Ek="black"):"string"===typeof a?(this.ha=nl,this.Ek=a):(this.ha=a,this.Ek="black");a=this.ha;a===ql?(this.Cd=uc,this.Sk=Ac):this.Sk=a===hl?this.Cd=xc:this.Cd=qc;this.Vr=0;this.Wq=NaN;this.ne=this.Hr=this.me=null;this.st=this.Fk=0;b&&Object.assign(this,b)}
gl.prototype.copy=function(){var a=new gl;a.ha=this.ha;a.Ek=this.Ek;a.Cd=this.Cd.I();a.Sk=this.Sk.I();a.Vr=this.Vr;a.Wq=this.Wq;null!==this.me&&(a.me=this.me.copy());a.Hr=this.Hr;return a};t=gl.prototype;t.freeze=function(){this.v=!0;null!==this.me&&this.me.freeze();return this};t.ea=function(){Object.isFrozen(this)&&C("cannot thaw constant: "+this);this.v=!1;null!==this.me&&this.me.ea();return this};t.gb=function(a){a.classType===gl&&(this.type=a)};
t.toString=function(){var a="Brush(";if(this.type===nl)a+=this.color;else if(a=this.type===ql?a+"Linear ":this.type===hl?a+"Radial ":this.type===pl?a+"Pattern ":a+"(unknown) ",a+=this.start+" "+this.end,null!==this.colorStops)for(var b=this.colorStops.iterator;b.next();)a+=" "+b.key+":"+b.value;return a+")"};
t.addColorStop=function(a,b){this.v&&wa(this);("number"!==typeof a||!isFinite(a)||1<a||0>a)&&xa(a,"0 <= loc <= 1",gl,"addColorStop:loc");null===this.me&&(this.me=new I);this.me.add(a,b);this.ha===nl&&(this.type=ql);this.ne=null;return this};
t.rA=function(a,b){this.v&&wa(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?Ul:b;if(this.type===nl)Qh(this.color),this.color=Vl(a,b);else if((this.type===ql||this.type===hl)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Qh(c.value),this.addColorStop(c.key,Vl(a,b));return this};function Wl(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?Ul:c;Qh(a);return Vl(b,c)}
t.sz=function(a,b){this.v&&wa(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?Ul:b;if(this.type===nl)Qh(this.color),this.color=Vl(-a,b);else if((this.type===ql||this.type===hl)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Qh(c.value),this.addColorStop(c.key,Vl(-a,b));return this};function Xl(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?Ul:c;Qh(a);return Vl(-b,c)}
function Yl(a,b,c){Qh(a);a=Zl.j;var d=Zl.D,e=Zl.o,f=Zl.L;Qh(b);void 0===c&&(c=.5);return"rgba("+Math.round((Zl.j-a)*c+a)+", "+Math.round((Zl.D-d)*c+d)+", "+Math.round((Zl.o-e)*c+e)+", "+Math.round((Zl.L-f)*c+f)+")"}
t.ay=function(){if(this.type===nl)return $l(this.color);if((this.type===ql||this.type===hl)&&null!==this.colorStops){var a=this.colorStops;if(this.type===hl)return $l(a.first().value);if(null!==a.get(.5))return $l(a.get(.5));if(2===a.count)return a=a.ya(),$l(Yl(a[0].value,a[1].value));for(var b=a.iterator,c=-1,d=-1,e=1,f=1;b.next();){var g=b.key,h=Math.abs(.5-b.key);e>f&&h<e?(c=g,e=h):f>=e&&h<f&&(d=g,f=h)}c>d&&(f=c,c=d,d=f,f=e);e=d-c;return $l(Yl(a.get(c),a.get(d),1-f/e))}return!1};
function $l(a){if(!a)return!1;if(a instanceof gl)return a.ay();Qh(a);return 128>(299*Zl.j+587*Zl.D+114*Zl.o)/1E3}
function Vl(a,b){switch(b){case Ul:b=100*am(Zl.j);var c=100*am(Zl.D),d=100*am(Zl.o);bm.j=.4124564*b+.3575761*c+.1804375*d;bm.D=.2126729*b+.7151522*c+.072175*d;bm.o=.0193339*b+.119192*c+.9503041*d;bm.L=Zl.L;b=cm(bm.j/dm[0]);c=cm(bm.D/dm[1]);d=cm(bm.o/dm[2]);em.j=116*c-16;em.D=500*(b-c);em.o=200*(c-d);em.L=bm.L;em.j=Math.min(100,Math.max(0,em.j+100*a));a=(em.j+16)/116;b=a-em.o/200;bm.j=dm[0]*fm(em.D/500+a);bm.D=dm[1]*(em.j>gm*hm?Math.pow(a,3):em.j/gm);bm.o=dm[2]*fm(b);bm.L=em.L;a=-.969266*bm.j+1.8760108*
bm.D+.041556*bm.o;b=.0556434*bm.j+-.2040259*bm.D+1.0572252*bm.o;Zl.j=255*im((3.2404542*bm.j+-1.5371385*bm.D+-.4985314*bm.o)/100);Zl.D=255*im(a/100);Zl.o=255*im(b/100);Zl.L=bm.L;Zl.j=Math.round(Zl.j);255<Zl.j?Zl.j=255:0>Zl.j&&(Zl.j=0);Zl.D=Math.round(Zl.D);255<Zl.D?Zl.D=255:0>Zl.D&&(Zl.D=0);Zl.o=Math.round(Zl.o);255<Zl.o?Zl.o=255:0>Zl.o&&(Zl.o=0);return"rgba("+Zl.j+", "+Zl.D+", "+Zl.o+", "+Zl.L+")";case jm:return Rh(),Sh.o=Math.min(100,Math.max(0,Sh.o+100*a)),"hsla("+Sh.j+", "+Sh.D+"%, "+Sh.o+"%, "+
Sh.L+")";default:C("Unknown color space: "+b)}}function Qh(a){Sl||(Tl(),Sl=!0);var b=km;if(null!==b){b.clearRect(0,0,1,1);b.fillStyle="#000000";var c=b.fillStyle;b.fillStyle=a;b.fillStyle!==c?(b.fillRect(0,0,1,1),a=b.getImageData(0,0,1,1).data,Zl.j=a[0],Zl.D=a[1],Zl.o=a[2],Zl.L=a[3]/255):(b.fillStyle="#FFFFFF",b.fillStyle=a,Zl.j=0,Zl.D=0,Zl.o=0,Zl.L=1)}}
function Rh(){var a=Zl.j/255,b=Zl.D/255,c=Zl.o/255,d=Math.max(a,b,c),e=Math.min(a,b,c),f=d-e;e=(d+e)/2;if(0===f)var g=a=0;else{switch(d){case a:g=(b-c)/f%6;break;case b:g=(c-a)/f+2;break;case c:g=(a-b)/f+4}g*=60;0>g&&(g+=360);a=f/(1-Math.abs(2*e-1))}Sh.j=Math.round(g);Sh.D=Math.round(100*a);Sh.o=Math.round(100*e);Sh.L=Zl.L}function am(a){a/=255;return.04045>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}function im(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055}
function cm(a){return a>hm?Math.pow(a,1/3):(gm*a+16)/116}function fm(a){var b=a*a*a;return b>hm?b:(116*a-16)/gm}function Hl(a,b){"string"!==typeof a&&(a instanceof gl||C("Value for "+b+" must be a color string or a Brush, not "+a))}function Tl(){km=Jg?(new uk(null)).context:null}
na.Object.defineProperties(gl.prototype,{type:{get:function(){return this.ha},set:function(a){this.v&&wa(this,a);this.ha=a;this.start.Ac()&&(a===ql?this.start=uc:a===hl&&(this.start=xc));this.end.Ac()&&(a===ql?this.end=Ac:a===hl&&(this.end=xc));this.ne=null}},color:{get:function(){return this.Ek},set:function(a){this.v&&wa(this,a);this.Ek=a;this.ne=null}},start:{get:function(){return this.Cd},set:function(a){this.v&&
wa(this,a);this.Cd=a.I();this.ne=null}},end:{get:function(){return this.Sk},set:function(a){this.v&&wa(this,a);this.Sk=a.I();this.ne=null}},startRadius:{get:function(){return this.Vr},set:function(a){this.v&&wa(this,a);0>a&&xa(a,">= zero",gl,"startRadius");this.Vr=a;this.ne=null}},endRadius:{get:function(){return this.Wq},set:function(a){this.v&&wa(this,a);0>a&&xa(a,">= zero",gl,"endRadius");this.Wq=a;this.ne=
null}},colorStops:{get:function(){return this.me},set:function(a){this.v&&wa(this,a);this.me=a;this.ne=null}},pattern:{get:function(){return this.Hr},set:function(a){this.v&&wa(this,a);this.Hr=a;this.ne=null}}});gl.prototype.isDark=gl.prototype.ay;gl.prototype.darkenBy=gl.prototype.sz;gl.prototype.lightenBy=gl.prototype.rA;gl.prototype.addColorStop=gl.prototype.addColorStop;
var hm=216/24389,gm=24389/27,dm=[95.047,100,108.883],km=null,Zl=new Rl,Sh=new Rl,bm=new Rl,em=new Rl,Sl=!1;gl.className="Brush";var nl;gl.Solid=nl=new D(gl,"Solid",0);var ql;gl.Linear=ql=new D(gl,"Linear",1);var hl;gl.Radial=hl=new D(gl,"Radial",2);var pl;gl.Pattern=pl=new D(gl,"Pattern",4);var Ul;gl.Lab=Ul=new D(gl,"Lab",5);var jm;gl.HSL=jm=new D(gl,"HSL",6);
gl.randomColor=function(a,b){void 0===a&&(a=128);void 0===b&&(b=Math.max(a,255));var c=Math.abs(b-a);b=Math.floor(a+Math.random()*c).toString(16);var d=Math.floor(a+Math.random()*c).toString(16);a=Math.floor(a+Math.random()*c).toString(16);2>b.length&&(b="0"+b);2>d.length&&(d="0"+d);2>a.length&&(a="0"+a);return"#"+b+d+a};
gl.isValidColor=function(a){if("black"===a)return!0;if(""===a)return!1;Sl||(Tl(),Sl=!0);var b=km;if(null===b)return!0;b.fillStyle="#000000";var c=b.fillStyle;b.fillStyle=a;if(b.fillStyle!==c)return!0;b.fillStyle="#FFFFFF";c=b.fillStyle;b.fillStyle=a;return b.fillStyle!==c};gl.lighten=function(a){return Wl(a)};gl.lightenBy=Wl;gl.darken=function(a){return Xl(a)};gl.darkenBy=Xl;gl.mix=Yl;gl.isDark=$l;function El(){this.na="Base"}El.prototype.measure=function(){};
El.prototype.uA=function(a,b,c,d,e){a.measure(b,c,d,e)};El.prototype.arrange=function(){};El.prototype.gz=function(a,b,c,d,e,f){a.arrange(b,c,d,e,f)};El.prototype.EA=function(a){a.ak()};El.prototype.oc=function(){};na.Object.defineProperties(El.prototype,{name:{get:function(){return this.na},set:function(a){this.na=a}},classType:{get:function(){return X}}});El.prototype.remeasureObject=El.prototype.EA;El.prototype.arrangeElement=El.prototype.gz;
El.prototype.measureElement=El.prototype.uA;El.className="PanelLayout";function lm(){this.na="Base"}ma(lm,El);
lm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;a=mm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===a){var m=l.margin,n=m.right+m.left;m=m.top+m.bottom;l.measure(b,c,f,g);var p=l.measuredBounds;n=Math.max(p.width+n,0);m=Math.max(p.height+m,0);p=l.position.x;var r=l.position.y;isFinite(p)||(p=0);isFinite(r)||(r=0);l instanceof xf&&l.isGeometryPositioned&&(l=l.strokeWidth/2,p-=l,r-=l);$b(e,p,r,n,m)}}};
lm.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding;a=c.x-e.left;c=c.y-e.top;for(e=0;e<d;e++){var f=b[e],g=f.measuredBounds,h=f.margin,k=f.position.x,l=f.position.y;k=isNaN(k)?-a:k-a;l=isNaN(l)?-c:l-c;if(f instanceof xf&&f.isGeometryPositioned){var m=f.strokeWidth/2;k-=m;l-=m}f.visible&&f.arrange(k+h.left,l+h.top,g.width,g.height)}};function nm(){this.na="Base"}ma(nm,El);
nm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;b=Ga();f=mm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===f){var m=bl(l,!1);if(m!==og&&m!==Pk)b.push(l);else{l.measure(Infinity,c,0,g);m=l.margin;l=l.measuredBounds;var n=Math.max(l.height+m.top+m.bottom,0);e.width+=Math.max(l.width+m.right+m.left,0);e.height=Math.max(e.height,n)}}}d=b.length;a.desiredSize.height?c=Math.min(a.desiredSize.height,a.maxSize.height):0!==e.height&&(c=Math.min(e.height,a.maxSize.height));for(a=0;a<d;a++)if(k=
b[a],k.visible||k===f)m=k.margin,h=m.right+m.left,m=m.top+m.bottom,k.measure(Infinity,c,0,g),k=k.measuredBounds,m=Math.max(k.height+m,0),e.width+=Math.max(k.width+h,0),e.height=Math.max(e.height,m);Ja(b)};
nm.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.top,g=a.isOpposite,h=g?c.width:e.left,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,r=p.top+p.bottom,q=f+e.bottom,u=n.height,w=bl(m,!1);if(isNaN(m.desiredSize.height)&&w===pd||w===Qk)u=Math.max(c.height-r-q,0);r=u+r+q;q=m.alignment;q.Mb()&&(q=a.defaultAlignment);q.hb()||(q=xc);g&&(h-=n.width+p.left+p.right);m.arrange(h+q.offsetX+p.left,l+q.offsetY+p.top+(c.height*q.y-r*q.y),n.width,u);g||(h+=n.width+
p.left+p.right)}}};function om(){this.na="Base"}ma(om,El);
om.prototype.measure=function(a,b,c,d,e,f){var g=d.length;c=Ga();for(var h=mm(a),k=0;k<g;k++){var l=d[k];if(l.visible||l===h){var m=bl(l,!1);if(m!==og&&m!==Qk)c.push(l);else{var n=l.margin;m=n.right+n.left;n=n.top+n.bottom;l.measure(b,Infinity,f,0);l=l.measuredBounds;Qb(e,Math.max(e.width,Math.max(l.width+m,0)),e.height+Math.max(l.height+n,0))}}}d=c.length;if(0!==d){a.desiredSize.width?b=Math.min(a.desiredSize.width,a.maxSize.width):0!==e.width&&(b=Math.min(e.width,a.maxSize.width));for(a=0;a<d;a++)if(k=
c[a],k.visible||k===h)l=k.margin,g=l.right+l.left,l=l.top+l.bottom,k.measure(b,Infinity,f,0),k=k.measuredBounds,l=Math.max(k.height+l,0),e.width=Math.max(e.width,Math.max(k.width+g,0)),e.height+=l;Ja(c)}};
om.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.left,g=a.isOpposite,h=g?c.height:e.top,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,r=p.left+p.right,q=f+e.right,u=n.width,w=bl(m,!1);if(isNaN(m.desiredSize.width)&&w===pd||w===Pk)u=Math.max(c.width-r-q,0);r=u+r+q;q=m.alignment;q.Mb()&&(q=a.defaultAlignment);q.hb()||(q=xc);g&&(h-=n.height+p.bottom+p.top);m.arrange(l+q.offsetX+p.left+(c.width*q.x-r*q.x),h+q.offsetY+p.top,u,n.height);g||(h+=n.height+
p.bottom+p.top)}}};function pm(){this.na="Base"}ma(pm,El);
pm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.pb(),l=k.margin,m=l.right+l.left,n=l.top+l.bottom;k.measure(b,c,f,g);var p=k.measuredBounds;f=p.width;g=p.height;var r=Math.max(f+m,0);var q=Math.max(g+n,0);var u=a.isClipping,w=M.allocAt(-l.left,-l.top,r,q),v=M.allocAt(0,0,f,g);qm(k,v,!0);f=v.width;g=v.height;for(var A=!0,y=mm(a),B=0;B<h;B++){var z=d[B],E=b,K=c;if(z!==k&&(z.visible||z===y)){l=z.margin;r=l.right+l.left;q=l.top+l.bottom;p=bl(z,!1);switch(p){case pd:E=f;K=g;break;case Pk:E=
f;break;case Qk:K=g}z.measure(E,K,0,0);p=z.measuredBounds;r=Math.max(p.width+r,0);q=Math.max(p.height+q,0);E=z.alignment;E.Mb()&&(E=a.defaultAlignment);E.hb()||(E=xc);var O=z.alignmentFocus;O.Mb()&&(O=xc);K=null;z instanceof X&&""!==z.Re&&(K=z.Ya(z.Re),K===z&&(K=null));var S=v.x,Q=v.y;if(null!==K){z.arrange(0,0,p.width,p.height);l=K.actualBounds;l=J.allocAt(l.x+(O.x*l.width-O.offsetX),l.y+(O.y*l.height-O.offsetY));for(K=K.panel;K!==z;)K.transform.Aa(l),K=K.panel;S+=E.x*f+E.offsetX-l.x;Q+=E.y*g+E.offsetY-
l.y;J.free(l)}else S+=E.x*f+E.offsetX-(O.x*p.width+O.offsetX)-l.left,Q+=E.y*g+E.offsetY-(O.y*p.height+O.offsetY)-l.top;A?(A=!1,e.h(S,Q,r,q)):$b(e,S,Q,r,q)}}A?e.assign(w):u?e.$u(v.x,v.y,v.width,v.height):$b(e,w.x,w.y,w.width,w.height);M.free(w);M.free(v);p=k.stretch;p===Ok&&(p=bl(k,!1));switch(p){case og:return;case pd:if(!isFinite(b)&&!isFinite(c))return;break;case Pk:if(!isFinite(b))return;break;case Qk:if(!isFinite(c))return}p=k.measuredBounds;f=p.width;g=p.height;r=Math.max(f+m,0);q=Math.max(g+
n,0);l=k.margin;v=M.allocAt(-l.left,-l.top,r,q);qm(k,v,!0);f=v.width;g=v.height;for(b=0;b<h;b++)c=d[b],c===k||!c.visible&&c!==y||(l=c.margin,r=l.right+l.left,q=l.top+l.bottom,p=c.measuredBounds,r=Math.max(p.width+r,0),q=Math.max(p.height+q,0),m=c.alignment,m.Mb()&&(m=a.defaultAlignment),m.hb()||(m=xc),c=c.alignmentFocus,c.Mb()&&(c=xc),A?(A=!1,e.h(m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,r,q)):$b(e,m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,
m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,r,q));A?e.assign(w):u?e.$u(v.x,v.y,v.width,v.height):$b(e,w.x,w.y,w.width,w.height);M.free(v)};
pm.prototype.arrange=function(a,b,c){var d=b.length,e=a.pb(),f=e.measuredBounds,g=f.width,h=f.height,k=a.padding;f=k.left;k=k.top;var l=f-c.x,m=k-c.y;e.arrange(l,m,g,h);g=M.allocAt(0,0,g,h);qm(e,g,!1);for(h=0;h<d;h++){var n=b[h];if(n!==e){l=n.measuredBounds;var p=l.width,r=l.height;m=n.alignment;m.Mb()&&(m=a.defaultAlignment);m.hb()||(m=xc);var q=n.alignmentFocus;q.Mb()&&(q=xc);l=null;n instanceof X&&""!==n.Re&&(l=n.Ya(n.Re),l===n&&(l=null));if(null!==l){var u=l.actualBounds;q=J.allocAt(u.x+(q.x*
u.width-q.offsetX),u.y+(q.y*u.height-q.offsetY));for(l=l.panel;l!==n;)l.transform.Aa(q),l=l.panel;l=m.x*g.width+m.offsetX-q.x;m=m.y*g.height+m.offsetY-q.y;J.free(q)}else l=m.x*g.width+m.offsetX-(q.x*p+q.offsetX),m=m.y*g.height+m.offsetY-(q.y*r+q.offsetY);l+=g.x-c.x;m+=g.y-c.y;n.visible&&n.arrange(f+l,k+m,p,r)}}M.free(g)};
function qm(a,b,c){var d=null;a instanceof X&&""!==a.Re&&(d=a.Ya(a.Re),d===a&&(d=null));if(null!==d)for(c&&a.arrange(0,0,b.width,b.height),b.assign(d.actualBounds),d=d.panel;d!==a;)d.transform.wq(b),d=d.panel}function rm(){this.na="Base"}ma(rm,El);
rm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.pb(),l=k.margin,m=b,n=c,p=l.right+l.left,r=l.top+l.bottom;k.measure(b,c,f,g);l=k.measuredBounds;var q=0,u=null;k instanceof xf&&(u=k,q=u.strokeWidth*u.scale);var w=Math.max(l.width+p,0);l=Math.max(l.height+r,0);var v=sm(k),A=v.x*w+v.offsetX;v=v.y*l+v.offsetY;var y=tm(k),B=y.x*w+y.offsetX;y=y.y*l+y.offsetY;isFinite(b)&&(m=Math.max(Math.abs(A-B)-q,0));isFinite(c)&&(n=Math.max(Math.abs(v-y)-q,0));q=Fb.alloc();q.h(0,0);a=mm(a);for(y=0;y<
h;y++)v=d[y],v===k||!v.visible&&v!==a||(l=v.margin,w=l.right+l.left,A=l.top+l.bottom,v.measure(m,n,0,0),l=v.measuredBounds,w=Math.max(l.width+w,0),l=Math.max(l.height+A,0),q.h(Math.max(w,q.width),Math.max(l,q.height)));if(1===h)e.width=w,e.height=l,Fb.free(q);else{v=sm(k);y=tm(k);h=d=0;y.x!==v.x&&y.y!==v.y&&(d=q.width/Math.abs(y.x-v.x),h=q.height/Math.abs(y.y-v.y));Fb.free(q);q=0;null!==u&&(q=u.strokeWidth*u.scale,pg(u)===qg&&(d=h=Math.max(d,h)));d+=Math.abs(v.offsetX)+Math.abs(y.offsetX)+q;h+=Math.abs(v.offsetY)+
Math.abs(y.offsetY)+q;u=k.stretch;u===Ok&&(u=bl(k,!1));switch(u){case og:g=f=0;break;case pd:isFinite(b)&&(d=b);isFinite(c)&&(h=c);break;case Pk:isFinite(b)&&(d=b);g=0;break;case Qk:f=0,isFinite(c)&&(h=c)}k.ak();k.measure(d,h,f,g);e.width=k.measuredBounds.width+p;e.height=k.measuredBounds.height+r}};
rm.prototype.arrange=function(a,b){var c=b.length,d=a.pb(),e=d.measuredBounds,f=M.alloc();f.h(0,0,1,1);var g=d.margin,h=g.left;g=g.top;var k=a.padding,l=k.left;k=k.top;d.arrange(l+h,k+g,e.width,e.height);var m=sm(d),n=tm(d),p=m.y*e.height+m.offsetY,r=n.x*e.width+n.offsetX;n=n.y*e.height+n.offsetY;f.x=m.x*e.width+m.offsetX;f.y=p;$b(f,r,n,0,0);f.x+=h+l;f.y+=g+k;for(e=0;e<c;e++)h=b[e],h!==d&&(l=h.measuredBounds,g=h.margin,k=Math.max(l.width+g.right+g.left,0),m=Math.max(l.height+g.top+g.bottom,0),p=h.alignment,
p.Mb()&&(p=a.defaultAlignment),p.hb()||(p=xc),k=f.width*p.x+p.offsetX-k*p.x+g.left+f.x,g=f.height*p.y+p.offsetY-m*p.y+g.top+f.y,h.visible&&(ac(f.x,f.y,f.width,f.height,k,g,l.width,l.height)?h.arrange(k,g,l.width,l.height):h.arrange(k,g,l.width,l.height,new M(f.x,f.y,f.width,f.height))));M.free(f)};function um(){this.na="Base";this.name="Table"}ma(um,El);
um.prototype.measure=function(a,b,c,d,e){for(var f=d.length,g=Ga(),h=Ga(),k=0;k<f;k++){var l=d[k],m=l instanceof X?l:null;if(null===m||m.type!==X.TableRow&&m.type!==X.TableColumn||!l.visible)g.push(l);else{h.push(m);for(var n=m.T.m,p=n.length,r=0;r<p;r++){var q=n[r];m.type===X.TableRow?q.row=l.row:m.type===X.TableColumn&&(q.column=l.column);g.push(q)}}}f=g.length;0===f&&(a.getRowDefinition(0),a.getColumnDefinition(0));for(var u=[],w=0;w<f;w++){var v=g[w];cj(v,!0);cl(v,!0);u[v.row]||(u[v.row]=[]);
u[v.row][v.column]||(u[v.row][v.column]=[]);u[v.row][v.column].push(v)}Ja(g);var A=Ga(),y=Ga(),B=Ga(),z={count:0},E={count:0},K=b,O=c,S=a.ob;f=S.length;for(var Q=0;Q<f;Q++){var H=S[Q];void 0!==H&&(H.actual=0)}S=a.ib;f=S.length;for(var da=0;da<f;da++)H=S[da],void 0!==H&&(H.actual=0);for(var ba=u.length,pa=0,Ca=0;Ca<ba;Ca++)u[Ca]&&(pa=Math.max(pa,u[Ca].length));var cb=Math.min(a.topIndex,ba-1),Ia=Math.min(a.leftIndex,pa-1),Da=0;ba=u.length;for(var ud=mm(a),Wb=0;Wb<ba;Wb++)if(u[Wb]){pa=u[Wb].length;
var Xb=a.getRowDefinition(Wb);Xb.actual=0;for(var gb=Xb.cc=0;gb<pa;gb++)if(u[Wb][gb]){var vd=a.getColumnDefinition(gb);void 0===A[gb]&&(vd.actual=0,vd.cc=0,A[gb]=!0);for(var $f=u[Wb][gb],ag=$f.length,Ge=0;Ge<ag;Ge++){var Bb=$f[Ge];if(Bb.visible||Bb===ud){var oh=1<Bb.rowSpan||1<Bb.columnSpan;oh&&(Wb<cb||gb<Ia||y.push(Bb));var bg=Bb.margin,ph=bg.right+bg.left,qh=bg.top+bg.bottom;var db=ul(Bb,Xb,vd,!1);var vi=Bb.desiredSize,Wj=!isNaN(vi.height),cg=!isNaN(vi.width)&&Wj;oh||db===og||cg||Wb<cb||gb<Ia||
(void 0!==z[gb]||db!==pd&&db!==Pk||(z[gb]=-1,z.count++),void 0!==E[Wb]||db!==pd&&db!==Qk||(E[Wb]=-1,E.count++),B.push(Bb));Bb.measure(Infinity,Infinity,0,0);if(!(Wb<cb||gb<Ia)){var hd=Bb.measuredBounds,ic=Math.max(hd.width+ph,0),Af=Math.max(hd.height+qh,0);if(1===Bb.rowSpan&&(db===og||db===Pk)){H=a.getRowDefinition(Wb);var rc=H.Jc();Da=Math.max(Af-H.actual,0);Da+rc>O&&(Da=Math.max(O-rc,0));var dg=0===H.la;H.cc=H.cc+Da;H.actual=H.la+Da;O=Math.max(O-(Da+(dg?rc:0)),0)}if(1===Bb.columnSpan&&(db===og||
db===Qk)){H=a.getColumnDefinition(gb);var rh=H.Jc();Da=Math.max(ic-H.actual,0);Da+rh>K&&(Da=Math.max(K-rh,0));var pn=0===H.la;H.cc=H.cc+Da;H.actual=H.la+Da;K=Math.max(K-(Da+(pn?rh:0)),0)}oh&&Bb.ak()}}}}}Ja(A);var Ed=0,je=0;f=a.columnCount;for(var eg=0;eg<f;eg++){var Ze=a.ib[eg];void 0!==Ze&&(Ed+=isNaN(Ze.vc)?Ze.cc:Ze.vc,0!==Ze.cc&&(Ed+=Ze.Jc()))}f=a.rowCount;for(var Vc=0;Vc<f;Vc++){var wd=a.ob[Vc];void 0!==wd&&(je+=isNaN(wd.vc)?wd.cc:wd.vc,0!==wd.cc&&(je+=wd.Jc()))}K=Math.max(b-Ed,0);var cc=O=Math.max(c-
je,0),sh=K;f=B.length;for(var th=0;th<f;th++){var Wc=B[th],wi=a.getRowDefinition(Wc.row),ke=a.getColumnDefinition(Wc.column),$e=Wc.measuredBounds,xd=Wc.margin,Xj=xd.right+xd.left,qn=xd.top+xd.bottom;z[Wc.column]=0===ke.cc&&void 0!==z[Wc.column]?Math.max($e.width+Xj,z[Wc.column]):null;E[Wc.row]=0===wi.cc&&void 0!==E[Wc.row]?Math.max($e.height+qn,E[Wc.row]):null}var Bf=0,Cb=0,Fd;for(Fd in E)"count"!==Fd&&(Bf+=E[Fd]);for(Fd in z)"count"!==Fd&&(Cb+=z[Fd]);for(var hb=Fb.alloc(),xi=0;xi<f;xi++){var Yb=
B[xi];if(Yb.visible||Yb===ud){var sc=a.getRowDefinition(Yb.row),jc=a.getColumnDefinition(Yb.column),Gd=0;isFinite(jc.width)?Gd=jc.width:(isFinite(K)&&null!==z[Yb.column]?0===Cb?Gd=jc.actual+K:Gd=z[Yb.column]/Cb*sh:null!==z[Yb.column]?Gd=K:Gd=jc.actual||K,Gd=Math.max(0,Gd-jc.Jc()));var Hd=0;isFinite(sc.height)?Hd=sc.height:(isFinite(O)&&null!==E[Yb.row]?0===Bf?Hd=sc.actual+O:Hd=E[Yb.row]/Bf*cc:null!==E[Yb.row]?Hd=O:Hd=sc.actual||O,Hd=Math.max(0,Hd-sc.Jc()));hb.h(Math.max(jc.minimum,Math.min(Gd,jc.maximum)),
Math.max(sc.minimum,Math.min(Hd,sc.maximum)));db=ul(Yb,sc,jc,!1);switch(db){case Pk:hb.height=Math.max(hb.height,sc.actual+O);break;case Qk:hb.width=Math.max(hb.width,jc.actual+K)}var fg=Yb.margin,Cc=fg.right+fg.left,uh=fg.top+fg.bottom;Yb.ak();Yb.measure(hb.width,hb.height,jc.minimum,sc.minimum);var gg=Yb.measuredBounds,Id=Math.max(gg.width+Cc,0),vh=Math.max(gg.height+uh,0);isFinite(K)&&(Id=Math.min(Id,hb.width));isFinite(O)&&(vh=Math.min(vh,hb.height));var af=0;af=sc.actual;sc.actual=Math.max(sc.actual,
vh);sc.cc=Math.max(sc.cc,vh);Da=sc.actual-af;O=Math.max(O-Da,0);null===E[Yb.row]&&(cc=Math.max(cc-Da,0));af=jc.actual;jc.actual=Math.max(jc.actual,Id);jc.cc=Math.max(jc.cc,Id);Da=jc.actual-af;K=Math.max(K-Da,0);null===z[Yb.column]&&(sh=Math.max(sh-Da,0))}}Ja(B);var Jd=Fb.alloc(),Kd=Ga(),Ld=Ga();f=y.length;if(0!==f)for(var He=0;He<ba;He++)if(u[He]){pa=u[He].length;var wh=a.getRowDefinition(He);Kd[He]=wh.actual;for(var le=0;le<pa;le++)if(u[He][le]){var rn=a.getColumnDefinition(le);Ld[le]=rn.actual}}for(var dc=
0;dc<f;dc++){var Oa=y[dc];if(Oa.visible||Oa===ud){var ec=a.getRowDefinition(Oa.row),Md=a.getColumnDefinition(Oa.column);hb.h(Math.max(Md.minimum,Math.min(b,Md.maximum)),Math.max(ec.minimum,Math.min(c,ec.maximum)));db=ul(Oa,ec,Md,!1);switch(db){case pd:0!==Ld[Md.index]&&(hb.width=Math.min(hb.width,Ld[Md.index]));0!==Kd[ec.index]&&(hb.height=Math.min(hb.height,Kd[ec.index]));break;case Pk:0!==Ld[Md.index]&&(hb.width=Math.min(hb.width,Ld[Md.index]));break;case Qk:0!==Kd[ec.index]&&(hb.height=Math.min(hb.height,
Kd[ec.index]))}isFinite(Md.width)&&(hb.width=Md.width);isFinite(ec.height)&&(hb.height=ec.height);Jd.h(0,0);for(var Ie=Md.minimum,xh=ec.minimum,Je=1;Je<Oa.rowSpan&&!(Oa.row+Je>=a.rowCount);Je++)H=a.getRowDefinition(Oa.row+Je),Da=0,Da=db===pd||db===Qk?Math.max(H.minimum,0===Kd[Oa.row+Je]?H.maximum:Math.min(Kd[Oa.row+Je],H.maximum)):Math.max(H.minimum,isNaN(H.vc)?H.maximum:Math.min(H.vc,H.maximum)),Jd.height+=Da,xh+=H.minimum;for(var Nc=1;Nc<Oa.columnSpan&&!(Oa.column+Nc>=a.columnCount);Nc++)H=a.getColumnDefinition(Oa.column+
Nc),Da=0,Da=db===pd||db===Pk?Math.max(H.minimum,0===Ld[Oa.column+Nc]?H.maximum:Math.min(Ld[Oa.column+Nc],H.maximum)):Math.max(H.minimum,isNaN(H.vc)?H.maximum:Math.min(H.vc,H.maximum)),Jd.width+=Da,Ie+=H.minimum;hb.width+=Jd.width;hb.height+=Jd.height;var bf=Oa.margin,yh=bf.right+bf.left,sn=bf.top+bf.bottom;Oa.measure(hb.width,hb.height,Ie,xh);for(var hg=Oa.measuredBounds,id=Math.max(hg.width+yh,0),Nd=Math.max(hg.height+sn,0),me=0,ne=0;ne<Oa.rowSpan&&!(Oa.row+ne>=a.rowCount);ne++)H=a.getRowDefinition(Oa.row+
ne),me+=H.total||0;if(me<Nd){var Od=Nd-me,oe=Nd-me;if(null!==Oa.spanAllocation)for(var Yj=Oa.spanAllocation,Ke=0;Ke<Oa.rowSpan&&!(0>=Od)&&!(Oa.row+Ke>=a.rowCount);Ke++){H=a.getRowDefinition(Oa.row+Ke);var yi=H.la||0,tn=Yj(Oa,H,oe);H.actual=Math.min(H.maximum,yi+tn);H.la!==yi&&(Od-=H.la-yi)}for(;0<Od;){var jd=H.la||0;isNaN(H.height)&&H.maximum>jd&&(H.actual=Math.min(H.maximum,jd+Od),H.la!==jd&&(Od-=H.la-jd));if(0===H.index)break;H=a.getRowDefinition(H.index-1)}}for(var Cf=0,zh=0;zh<Oa.columnSpan&&
!(Oa.column+zh>=a.columnCount);zh++)H=a.getColumnDefinition(Oa.column+zh),Cf+=H.total||0;if(Cf<id){var ig=id-Cf,Rt=id-Cf;if(null!==Oa.spanAllocation)for(var St=Oa.spanAllocation,Zj=0;Zj<Oa.columnSpan&&!(0>=ig)&&!(Oa.column+Zj>=a.columnCount);Zj++){H=a.getColumnDefinition(Oa.column+Zj);var un=H.la||0,Tt=St(Oa,H,Rt);H.actual=Math.min(H.maximum,un+Tt);H.la!==un&&(ig-=H.la-un)}for(;0<ig;){var ak=H.la||0;isNaN(H.width)&&H.maximum>ak&&(H.actual=Math.min(H.maximum,ak+ig),H.la!==ak&&(ig-=H.la-ak));if(0===
H.index)break;H=a.getColumnDefinition(H.index-1)}}}}Ja(y);Fb.free(Jd);Fb.free(hb);void 0!==Kd&&Ja(Kd);void 0!==Ld&&Ja(Ld);var jg=0,kg=0,bk=a.desiredSize,cr=a.maxSize;db=bl(a,!0);var zi=je=Ed=0,Ai=0;f=a.columnCount;for(var ck=0;ck<f;ck++)void 0!==a.ib[ck]&&(H=a.getColumnDefinition(ck),isFinite(H.width)?(zi+=H.width,zi+=H.Jc()):vm(H)===wm?(zi+=H.la,zi+=H.Jc()):0!==H.la&&(Ed+=H.la,Ed+=H.Jc()));isFinite(bk.width)?jg=Math.min(bk.width,cr.width):jg=db!==og&&isFinite(b)?b:Ed;jg=Math.max(jg,a.minSize.width);
jg=Math.max(jg-zi,0);for(var Ut=0===Ed?1:Math.max(jg/Ed,1),ek=0;ek<f;ek++)void 0!==a.ib[ek]&&(H=a.getColumnDefinition(ek),isFinite(H.width)||vm(H)===wm||(H.actual=H.la*Ut),H.position=e.width,0!==H.la&&(e.width+=H.la,e.width+=H.Jc()));f=a.rowCount;for(var fk=0;fk<f;fk++)void 0!==a.ob[fk]&&(H=a.getRowDefinition(fk),isFinite(H.height)?(Ai+=H.height,Ai+=H.Jc()):vm(H)===wm?(Ai+=H.la,Ai+=H.Jc()):0!==H.la&&(je+=H.la,0!==H.la&&(je+=H.Jc())));isFinite(bk.height)?kg=Math.min(bk.height,cr.height):kg=db!==og&&
isFinite(c)?c:je;kg=Math.max(kg,a.minSize.height);kg=Math.max(kg-Ai,0);for(var Vt=0===je?1:Math.max(kg/je,1),gk=0;gk<f;gk++)void 0!==a.ob[gk]&&(H=a.getRowDefinition(gk),isFinite(H.height)||vm(H)===wm||(H.actual=H.la*Vt),H.position=e.height,0!==H.la&&(e.height+=H.la,0!==H.la&&(e.height+=H.Jc())));f=h.length;for(var vn=0;vn<f;vn++){var kd=h[vn],wn=0,xn=0;kd.type===X.TableRow?(wn=e.width,H=a.getRowDefinition(kd.row),xn=H.actual):(H=a.getColumnDefinition(kd.column),wn=H.actual,xn=e.height);kd.measuredBounds.h(0,
0,wn,xn);cj(kd,!1);u[kd.row]||(u[kd.row]=[]);u[kd.row][kd.column]||(u[kd.row][kd.column]=[]);u[kd.row][kd.column].push(kd)}Ja(h);a.cp=u};
um.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding,f=e.left;e=e.top;for(var g=a.cp,h,k,l=g.length,m=0,n=0;n<l;n++)g[n]&&(m=Math.max(m,g[n].length));for(n=Math.min(a.topIndex,l-1);n!==l&&(void 0===a.ob[n]||0===a.ob[n].la);)n++;n=Math.min(n,l-1);n=-a.ob[n].position;for(h=Math.min(a.leftIndex,m-1);h!==m&&(void 0===a.ib[h]||0===a.ib[h].la);)h++;h=Math.min(h,m-1);for(var p=-a.ib[h].position,r=Fb.alloc(),q=0;q<l;q++)if(g[q]){m=g[q].length;var u=a.getRowDefinition(q);k=u.position+n+e;0!==u.la&&
(k+=u.Cu());for(var w=0;w<m;w++)if(g[q][w]){var v=a.getColumnDefinition(w);h=v.position+p+f;0!==v.la&&(h+=v.Cu());for(var A=g[q][w],y=A.length,B=0;B<y;B++){var z=A[B],E=z.measuredBounds,K=z instanceof X?z:null;if(null===K||K.type!==X.TableRow&&K.type!==X.TableColumn){r.h(0,0);for(var O=1;O<z.rowSpan&&!(q+O>=a.rowCount);O++)K=a.getRowDefinition(q+O),r.height+=K.total;for(O=1;O<z.columnSpan&&!(w+O>=a.columnCount);O++)K=a.getColumnDefinition(w+O),r.width+=K.total;var S=v.la+r.width,Q=u.la+r.height;O=
h;K=k;var H=S,da=Q,ba=h,pa=k,Ca=S,cb=Q;h+S>c.width&&(Ca=Math.max(c.width-h,0));k+Q>c.height&&(cb=Math.max(c.height-k,0));var Ia=z.alignment;if(Ia.Mb()){Ia=a.defaultAlignment;Ia.hb()||(Ia=xc);var Da=Ia.x;var ud=Ia.y;var Wb=Ia.offsetX;Ia=Ia.offsetY;var Xb=v.alignment,gb=u.alignment;Xb.hb()&&(Da=Xb.x,Wb=Xb.offsetX);gb.hb()&&(ud=gb.y,Ia=gb.offsetY)}else Da=Ia.x,ud=Ia.y,Wb=Ia.offsetX,Ia=Ia.offsetY;if(isNaN(Da)||isNaN(ud))ud=Da=.5,Ia=Wb=0;Xb=E.width;gb=E.height;var vd=z.margin,$f=vd.left+vd.right,ag=vd.top+
vd.bottom,Ge=ul(z,u,v,!1);!isNaN(z.desiredSize.width)||Ge!==pd&&Ge!==Pk||(Xb=Math.max(S-$f,0));!isNaN(z.desiredSize.height)||Ge!==pd&&Ge!==Qk||(gb=Math.max(Q-ag,0));S=z.maxSize;Q=z.minSize;Xb=Math.min(S.width,Xb);gb=Math.min(S.height,gb);Xb=Math.max(Q.width,Xb);gb=Math.max(Q.height,gb);S=gb+ag;O+=H*Da-(Xb+$f)*Da+Wb+vd.left;K+=da*ud-S*ud+Ia+vd.top;z.visible&&(ac(ba,pa,Ca,cb,O,K,E.width,E.height)?z.arrange(O,K,Xb,gb):z.arrange(O,K,Xb,gb,new M(ba,pa,Ca,cb)))}else z.bl(),z.actualBounds.ea(),H=z.actualBounds,
O=M.allocAt(H.x,H.y,H.width,H.height),H.x=K.type===X.TableRow?f:h,H.y=K.type===X.TableColumn?e:k,H.width=E.width,H.height=E.height,z.actualBounds.freeze(),cl(z,!1),Tb(O,H)||(E=z.part,null!==E&&(E.Gh(),z.Eo(E))),M.free(O)}}}Fb.free(r);for(a=0;a<d;a++)c=b[a],f=c instanceof X?c:null,null===f||f.type!==X.TableRow&&f.type!==X.TableColumn||(f=c.actualBounds,c.naturalBounds.ea(),c.naturalBounds.h(0,0,f.width,f.height),c.naturalBounds.freeze())};function xm(){this.na="Base"}ma(xm,El);
xm.prototype.measure=function(){};xm.prototype.arrange=function(){};function ym(){this.na="Base"}ma(ym,El);ym.prototype.measure=function(){};ym.prototype.arrange=function(){};function zm(){this.na="Base"}ma(zm,El);
zm.prototype.measure=function(a,b,c,d,e,f,g){1<d.length&&C("Viewbox Panel cannot contain more than one GraphObject.");d=d[0];d.sa=1;d.ak();d.measure(Infinity,Infinity,f,g);var h=d.measuredBounds,k=d.margin,l=k.right+k.left;k=k.top+k.bottom;if(isFinite(b)||isFinite(c)){var m=d.scale,n=h.width;h=h.height;var p=Math.max(b-l,0),r=Math.max(c-k,0),q=1;a.viewboxStretch===qg?0!==n&&0!==h&&(q=Math.min(p/n,r/h)):0!==n&&0!==h&&(q=Math.max(p/n,r/h));0===q&&(q=1E-4);d.sa*=q;m!==d.scale&&(cj(d,!0),d.measure(Infinity,
Infinity,f,g))}h=d.measuredBounds;e.width=isFinite(b)?b:Math.max(h.width+l,0);e.height=isFinite(c)?c:Math.max(h.height+k,0)};zm.prototype.arrange=function(a,b,c){b=b[0];var d=b.measuredBounds,e=b.margin,f=Math.max(d.width+(e.right+e.left),0);e=Math.max(d.height+(e.top+e.bottom),0);var g=b.alignment;g.Mb()&&(g=a.defaultAlignment);g.hb()||(g=xc);b.arrange(c.width*g.x-f*g.x+g.offsetX,c.height*g.y-e*g.y+g.offsetY,d.width,d.height)};function Am(){this.na="Base"}ma(Am,El);Am.prototype.measure=function(){};
Am.prototype.arrange=function(){};
Am.prototype.oc=function(a,b,c){c=a.Af()*c.scale;0>=c&&(c=1);var d=a.gridCellSize,e=d.width;d=d.height;var f=a.naturalBounds,g=a.actualBounds,h=f.width,k=f.height,l=Math.ceil(h/e),m=Math.ceil(k/d),n=a.gridOrigin,p=n.x;n=n.y;b.save();b.beginPath();b.rect(0,0,h,k);b.clip();for(var r=[],q=a.T.m,u=q.length,w=0;w<u;w++){var v=q[w],A=[];r.push(A);if(v.visible){var y=v.interval;if(!(0>y)){v=Mj(v.figure);for(var B=0;B<u;B++)if(B!==w){var z=q[B];z.visible&&Mj(z.figure)===v&&(z=z.interval,z>y&&A.push(z))}}}}q=
a.T.m;u=q.length;for(w=0;w<u;w++){var E=q[w];if(E.visible&&(A=E.interval||1,v=Math.abs(A),!(2>e*v*c))){y=E.segmentIndex;if(!isFinite(y)||isNaN(y))y=0;0>y&&(y=v-Math.min(-y,v));y=Math.round(y%v);v=E.opacity;B=1;if(1!==v){if(0===v)continue;B=b.globalAlpha;b.globalAlpha=B*v}z=r[w];var K=!1,O=E.strokeDashArray;null!==O&&(K=!0,b.ns(O,E.strokeDashOffset));if("LineV"===E.figure&&null!==E.stroke&&0<E.strokeWidth){b.lineWidth=E.strokeWidth;ci(a,b,E.stroke,!1,!1,f,g);b.beginPath();for(O=E=Math.floor((p-e)/
e);O<=E+l;O++){var S=O*e+p;0<=S&&S<=h&&Bm(O,A,y,z)&&(b.moveTo(S,0),b.lineTo(S,k))}b.stroke()}else if("LineH"===E.figure&&null!==E.stroke&&0<E.strokeWidth){b.lineWidth=E.strokeWidth;ci(a,b,E.stroke,!1,!1,f,g);b.beginPath();for(O=E=Math.floor((n-d)/d);O<=E+m;O++)S=O*d+n,0<=S&&S<=k&&Bm(O,A,y,z)&&(b.moveTo(0,S),b.lineTo(h,S));b.stroke()}else if("BarV"===E.figure&&null!==E.fill)for(ci(a,b,E.fill,!0,!1,f,g),E=E.width,isNaN(E)&&(E=e),S=O=Math.floor((p-e)/e);S<=O+l;S++){var Q=S*e+p;0<=Q+E&&Q<=h&&Bm(S,A,y,
z)&&b.fillRect(Q,0,E,k)}else if("BarH"===E.figure&&null!==E.fill)for(ci(a,b,E.fill,!0,!1,f,g),E=E.height,isNaN(E)&&(E=d),S=O=Math.floor((n-d)/d);S<=O+m;S++)Q=S*d+n,0<=Q+E&&Q<=k&&Bm(S,A,y,z)&&b.fillRect(0,Q,h,E);K&&b.ls();1!==v&&(b.globalAlpha=B)}}b.restore();b.Ic(!1)};function Bm(a,b,c,d){if(0>b)return a%b===c;if(a%b!==c)return!1;b=d.length;for(var e=0;e<b;e++)if(a%d[e]===c)return!1;return!0}function Cm(){this.na="Base"}ma(Cm,El);
Cm.prototype.measure=function(a,b,c,d,e){c=d.length;if(a instanceof ye||a instanceof T){var f=null,g=null;a instanceof T&&(f=a);a instanceof ye&&(g=a,f=g.adornedPart,null===a.j&&(a.j=[]));if(f instanceof T){var h=f;if(0===c)Qb(a.naturalBounds,0,0),a.measuredBounds.h(0,0,0,0);else{var k=a instanceof ye?null:f.path,l=f.routeBounds;b=a.ig;b.h(0,0,l.width,l.height);var m=h.points,n=f.pointsCount;null!==g?g.fk(!1):null!==f&&f.fk(!1);var p=l.width,r=l.height;a.location.h(l.x,l.y);var q=a.j;q.length=0;null!==
k&&(Dm(a,p,r,k),g=k.measuredBounds,b.Rc(g),q.push(g));g=nd.alloc();for(var u=J.alloc(),w=J.alloc(),v=0;v<c;v++){var A=d[v];if(A!==k)if(A.isPanelMain&&A instanceof xf){Dm(a,p,r,A);var y=A.measuredBounds;b.Rc(y);q.push(y)}else if(2>n)A.measure(Infinity,Infinity,0,0),y=A.measuredBounds,b.Rc(y),q.push(y);else{var B=A.segmentIndex,z=A.segmentFraction,E=A.alignmentFocus;E.Ac()&&(E=xc);var K=A.segmentOrientation,O=A.segmentOffset;if(isNaN(B)){var S=h.ma;y=Ga();S.Uu(z,y);var Q=J.allocAt(y[0],y[1]);Q.add(h.i(0));
S.type===P.j?Q.offset(-S.startX,-S.startY):(S=S.figures.first(),null!==S&&Q.offset(-S.startX,-S.startY));S=y[2];if(K!==Rf){var H=h.computeAngle(A,K,S);A.zb=H}H=Q.x-l.x;var da=Q.y-l.y;J.free(Q);Ja(y)}else if(B<-n||B>=n)y=J.alloc(),h.ug(),h.computeMidPoint(y),S=h.midAngle,K!==Rf&&(H=h.computeAngle(A,K,S),A.zb=H),H=y.x-l.x,da=y.y-l.y,J.free(y);else{H=0;0<=B?(da=m.J(B),y=B<n-1?m.J(B+1):da):(H=n+B,da=m.J(H),y=0<H?m.J(H-1):da);if(da.Ua(y)){0<=B?(S=0<B?m.J(B-1):da,H=B<n-2?m.J(B+2):y):(S=H<n-1?m.J(H+1):da,
H=1<H?m.J(H-2):y);Q=S.xf(da);var ba=y.xf(H);S=Q>ba+10?0<=B?S.Pa(da):da.Pa(S):ba>Q+10?0<=B?y.Pa(H):H.Pa(y):0<=B?S.Pa(H):H.Pa(S)}else S=0<=B?da.Pa(y):y.Pa(da);K!==Rf&&(H=h.computeAngle(A,K,S),A.zb=H);H=da.x+(y.x-da.x)*z-l.x;da=da.y+(y.y-da.y)*z-l.y}A.measure(Infinity,Infinity,0,0);y=A.measuredBounds;Q=A.naturalBounds;var pa=0;A instanceof xf&&(pa=A.strokeWidth);ba=Q.width+pa;var Ca=Q.height+pa;g.reset();g.translate(-y.x,-y.y);g.scale(A.scale,A.scale);g.rotate(K===Rf?A.angle:S,ba/2,Ca/2);K!==Em&&K!==
Fm||g.rotate(90,ba/2,Ca/2);K!==Gm&&K!==Hm||g.rotate(-90,ba/2,Ca/2);K===Im&&(45<S&&135>S||225<S&&315>S)&&g.rotate(-S,ba/2,Ca/2);Q=new M(0,0,ba,Ca);u.Ti(Q,E);g.Aa(u);E=-u.x+pa/2*A.scale;A=-u.y+pa/2*A.scale;w.assign(O);pa=isNaN(O.x);var cb=isNaN(O.y);if(pa||cb){ba=ba/2+3;Ca=Ca/2+3;var Ia=45<=S&&135>=S,Da=225<=S&&315>=S;K===Rf&&(Ia||Da)?(w.x=cb?ba:O.y,w.y=pa?Ca:O.x,Ia?0<=B||isNaN(B)&&.5>z||!pa||(w.y=-Ca):Da&&((0<=B||isNaN(B)&&.5>z)&&pa&&(w.y=-Ca),cb&&(w.x=-ba))):(pa&&(w.x=0<=B||isNaN(B)&&.5>z?ba:-ba),
cb&&(w.y=-Ca),w.rotate(S))}else w.rotate(S);H+=w.x;da+=w.y;Q.set(y);Q.h(H+E,da+A,y.width,y.height);q.push(Q);b.Rc(Q)}}if(null!==f)for(d=f.labelNodes;d.next();)d.value.measure(Infinity,Infinity);a.ig=b;a=a.location;a.h(a.x+b.x,a.y+b.y);Qb(e,b.width||0,b.height||0);nd.free(g);J.free(u);J.free(w)}}}};
Cm.prototype.arrange=function(a,b){var c=b.length;if(a instanceof ye||a instanceof T){var d=a,e=null;a instanceof ye&&(e=a,d=e.adornedPart);var f=a instanceof ye?null:d.path,g=a.j;if(0!==g.length){var h=0;if(null!==f&&h<g.length){var k=g[h];h++;f.arrange(k.x-a.ig.x,k.y-a.ig.y,k.width,k.height)}for(k=0;k<c;k++){var l=b[k];if(l!==f&&h<g.length){var m=g[h];h++;l.arrange(m.x-a.ig.x,m.y-a.ig.y,m.width,m.height)}}}b=d.points;c=b.count;if(2<=c&&a instanceof T)for(f=a.labelNodes;f.next();){var n=a;g=f.value;
h=g.segmentIndex;k=g.segmentFraction;var p=g.alignmentFocus;l=g.segmentOrientation;m=g.segmentOffset;if(isNaN(h)){var r=n.ma;var q=Ga();r.Uu(k,q);var u=J.allocAt(q[0],q[1]);u.add(n.i(0));r.type===P.j?u.offset(-r.startX,-r.startY):(r=r.figures.first(),u.offset(-r.startX,-r.startY));r=q[2];l!==Rf&&(n=n.computeAngle(g,l,r),g.angle=n);n=u.x;var w=u.y;J.free(u);Ja(q)}else if(h<-c||h>=c)q=J.alloc(),r=n,w=q,r.ug(),r.computeMidPoint(w),r=n.midAngle,l!==Rf&&(n=n.computeAngle(g,l,r),g.angle=n),n=q.x,w=q.y,
J.free(q);else{u=0;0<=h?(q=b.m[h],w=h<c-1?b.m[h+1]:q):(u=c+h,q=b.m[u],w=0<u?b.m[u-1]:q);if(q.Ua(w)){0<=h?(r=0<h?b.m[h-1]:q,u=h<c-2?b.m[h+2]:w):(r=u<c-1?b.m[u+1]:q,u=1<u?b.m[u-2]:w);var v=r.xf(q),A=w.xf(u);r=v>A+10?0<=h?r.Pa(q):q.Pa(r):A>v+10?0<=h?w.Pa(u):u.Pa(w):0<=h?r.Pa(u):u.Pa(r)}else r=0<=h?q.Pa(w):w.Pa(q);l!==Rf&&(n=n.computeAngle(g,l,r),g.angle=n);n=q.x+(w.x-q.x)*k;w=q.y+(w.y-q.y)*k}if(p.Ds())g.location=new J(n,w);else{p.Ac()&&(p=xc);q=nd.alloc();q.reset();q.scale(g.scale,g.scale);q.rotate(g.angle,
0,0);var y=g.naturalBounds;u=M.allocAt(0,0,y.width,y.height);v=J.alloc();v.Ti(u,p);q.Aa(v);p=-v.x;A=-v.y;var B=y.width,z=y.height;y=J.alloc();y.assign(m);var E=isNaN(m.x),K=isNaN(m.y);if(E||K){B=B/2+3;z=z/2+3;var O=45<=r&&135>=r,S=225<=r&&315>=r;l===Rf&&(O||S)?(y.x=K?B:m.y,y.y=E?z:m.x,O?0<=h||isNaN(h)&&.5>k||!E||(y.y=-z):S&&((0<=h||isNaN(h)&&.5>k)&&E&&(y.y=-z),K&&(y.x=-B))):(E&&(y.x=0<=h||isNaN(h)&&.5>k?B:-B),K&&(y.y=-z),y.rotate(r))}else y.rotate(r);n+=y.x;w+=y.y;q.wq(u);p+=u.x;A+=u.y;h=J.allocAt(n+
p,w+A);g.move(h);J.free(h);J.free(y);J.free(v);M.free(u);nd.free(q)}}null!==e?e.fk(!1):d.fk(!1)}};
function Dm(a,b,c,d){if(!1!==hj(d)){var e=d.strokeWidth;0===e&&a instanceof ye&&a.type===X.Link&&a.adornedObject instanceof xf&&(e=a.adornedObject.strokeWidth);e*=d.sa;a instanceof T&&null!==a.ma?(a=a.ma.bounds,d.xe(a.x-e/2,a.y-e/2,a.width+e,a.height+e)):a instanceof ye&&null!==a.adornedPart.ma?(a=a.adornedPart.ma.bounds,d.xe(a.x-e/2,a.y-e/2,a.width+e,a.height+e)):d.xe(-(e/2),-(e/2),b+e,c+e);cj(d,!1)}}function Jm(){this.na="Base"}ma(Jm,El);
Jm.prototype.measure=function(a,b,c,d,e,f,g){var h=a.pb();a.Pg=[];var k=h.margin,l=k.right+k.left,m=k.top+k.bottom;h.measure(b,c,f,g);var n=h.measuredBounds,p=new M(-k.left,-k.top,Math.max(n.width+l,0),Math.max(n.height+m,0));a.Pg.push(p);e.assign(p);for(var r=h.geometry,q=h.strokeWidth,u=r.flattenedSegments,w=r.flattenedLengths,v=r.flattenedTotalLength,A=u.length,y=0,B=0,z=Ga(),E=0;E<A;E++){var K=u[E],O=[];B=y=0;for(var S=K.length,Q=0;Q<S;Q+=2){var H=K[Q],da=K[Q+1];if(0!==Q){var ba=180*Math.atan2(da-
B,H-y)/Math.PI;0>ba&&(ba+=360);O.push(ba)}y=H;B=da}z.push(O)}if(null===a.Rf){for(var pa=[],Ca=a.T.m,cb=Ca.length,Ia=0;Ia<cb;Ia++){var Da=Ca[Ia],ud=[];pa.push(ud);if(Da.visible){var Wb=Da.interval;if(!(0>Wb))for(var Xb=0;Xb<cb;Xb++)if(Xb!==Ia){var gb=Ca[Xb];if(gb.visible&&Da.constructor===gb.constructor){var vd=gb.interval;vd>Wb&&ud.push(vd)}}}}a.Rf=pa}var $f=a.Rf;var ag=a.T.m,Ge=ag.length,Bb=0,oh=0,bg=v;a.ij=[];for(var ph,qh=0;qh<Ge;qh++){var db=ag[qh];ph=[];if(db.visible&&db!==h){var vi=Math.abs(db.interval),
Wj=a.graduatedTickUnit;if(!(2>Wj*vi*v/a.graduatedRange)){var cg=w[0][0],hd=0,ic=0;oh=v*db.graduatedStart-1E-4;bg=v*db.graduatedEnd+1E-4;var Af=Wj*vi,rc=a.graduatedTickBase;if(rc<a.graduatedMin){var dg=(a.graduatedMin-rc)/Af;dg=0===dg%1?dg:Math.floor(dg+1);rc+=dg*Af}else rc>a.graduatedMin+Af&&(rc-=Math.floor((rc-a.graduatedMin)/Af)*Af);for(var rh=$f[qh],pn=rc,Ed=1;rc<a.graduatedMax+5E-8;Ed++){a:{for(var je=rh.length,eg=0;eg<je;eg++)if(L.aa((rc-a.graduatedTickBase)%(rh[eg]*a.graduatedTickUnit),0)){var Ze=
!1;break a}Ze=!0}if(Ze&&(null===db.graduatedSkip||!db.graduatedSkip(rc))&&(Bb=(rc-a.graduatedMin)*v/a.graduatedRange,Bb>v&&(Bb=v),oh<=Bb&&Bb<=bg)){for(var Vc=z[hd][ic],wd=w[hd][ic];hd<w.length;){for(;Bb>cg&&ic<w[hd].length-1;)ic++,Vc=z[hd][ic],wd=w[hd][ic],cg+=wd;if(Bb<=cg)break;hd++;ic=0;Vc=z[hd][ic];wd=w[hd][ic];cg+=wd}var cc=u[hd],sh=cc[2*ic],th=cc[2*ic+1],Wc=(Bb-(cg-wd))/wd,wi=new J(sh+(cc[2*ic+2]-sh)*Wc+q/2-r.bounds.x,th+(cc[2*ic+3]-th)*Wc+q/2-r.bounds.y);wi.scale(h.scale,h.scale);var ke=Vc,
$e=z[hd];1E-4>Wc?0<ic?ke=$e[ic-1]:L.aa(cc[0],cc[cc.length-2])&&L.aa(cc[1],cc[cc.length-1])&&(ke=$e[$e.length-1]):.9999<Wc&&(ic+1<$e.length?ke=$e[ic+1]:L.aa(cc[0],cc[cc.length-2])&&L.aa(cc[1],cc[cc.length-1])&&(ke=$e[0]));Vc!==ke&&(180<Math.abs(Vc-ke)&&(Vc<ke?Vc+=360:ke+=360),Vc=(Vc+ke)/2%360);if(db instanceof Lg){var xd="";null!==db.graduatedFunction?(xd=db.graduatedFunction(rc),xd=null!==xd&&void 0!==xd?xd.toString():""):xd=(+rc.toFixed(2)).toString();""!==xd&&ph.push({jm:wi,angle:Vc,text:xd})}else ph.push({jm:wi,
angle:Vc})}rc=pn+Ed*Af}}}a.ij.push(ph)}Ja(z);var Xj=a.ij;if(null!==Xj)for(var qn=d.length,Bf=0;Bf<qn;Bf++){var Cb=d[Bf],Fd=Xj[Bf];if(Cb.visible&&Cb!==h&&0!==Fd.length){if(Cb instanceof xf){var hb=a,xi=e,Yb=Cb.alignmentFocus;Yb.Ac()&&(Yb=uc);var sc=Cb.angle;Cb.zb=0;Cb.measure(Infinity,Infinity,0,0);Cb.zb=sc;var jc=Cb.measuredBounds,Gd=jc.width,Hd=jc.height,fg=M.allocAt(0,0,Gd,Hd),Cc=J.alloc();Cc.Ti(fg,Yb);M.free(fg);for(var uh=-Cc.x,gg=-Cc.y,Id=new M,vh=Fd.length,af=0;af<vh;af++)for(var Jd=Fd[af],
Kd=Jd.jm.x,Ld=Jd.jm.y,He=Jd.angle,wh=0;4>wh;wh++){switch(wh){case 0:Cc.h(uh,gg);break;case 1:Cc.h(uh+Gd,gg);break;case 2:Cc.h(uh,gg+Hd);break;case 3:Cc.h(uh+Gd,gg+Hd)}Cc.rotate(He+Cb.angle);Cc.offset(Kd,Ld);0===af&&0===wh?Id.h(Cc.x,Cc.y,0,0):Id.Oe(Cc);Cc.offset(-Kd,-Ld);Cc.rotate(-He-Cb.angle)}J.free(Cc);null!==hb.Pg&&hb.Pg.push(Id);$b(xi,Id.x,Id.y,Id.width,Id.height)}else if(Cb instanceof Lg){var le=a,rn=e;null===le.qh&&(le.qh=new Lg);var dc=le.qh;Km(dc,Cb);var Oa=Cb.alignmentFocus;Oa.Ac()&&(Oa=
uc);for(var ec=Cb.segmentOrientation,Md=Cb.segmentOffset,Ie=new M,xh=0,Je=0,Nc=0,bf=0,yh=0,sn=Fd.length,hg=0;hg<sn;hg++){var id=Fd[hg];xh=id.jm.x;Je=id.jm.y;Nc=id.angle;yh=bf=Cb.angle;ec!==Rf&&(yh=ec===Lm||ec===Mm?Nc+Cb.angle:Nc,bf=T.computeAngle(ec,yh));dc.zb=bf;dc.text=id.text||"";dc.measure(Infinity,Infinity,0,0);var Nd=dc.measuredBounds,me=dc.naturalBounds,ne=me.width,Od=me.height,oe=nd.alloc();oe.reset();oe.translate(-Nd.x,-Nd.y);oe.scale(dc.scale,dc.scale);oe.rotate(yh,ne/2,Od/2);ec!==Em&&ec!==
Fm||oe.rotate(90,ne/2,Od/2);ec!==Gm&&ec!==Hm||oe.rotate(-90,ne/2,Od/2);ec===Im&&(45<Nc&&135>Nc||225<Nc&&315>Nc)&&oe.rotate(-Nc,ne/2,Od/2);var Yj=M.allocAt(0,0,ne,Od),Ke=J.alloc();Ke.Ti(Yj,Oa);oe.Aa(Ke);var yi=-Ke.x,tn=-Ke.y,jd=J.alloc();jd.assign(Md);isNaN(jd.x)&&(jd.x=ne/2+3);isNaN(jd.y)&&(jd.y=-(Od/2+3));jd.rotate(Nc);xh+=jd.x+yi;Je+=jd.y+tn;var Cf=new M(xh,Je,Nd.width,Nd.height),zh=new M(Nd.x,Nd.y,Nd.width,Nd.height),ig=new M(me.x,me.y,me.width,me.height);id.pA=bf;id.lineCount=dc.lineCount;id.lines=
[dc.sb,dc.ei,dc.re,dc.Ce,dc.Dc,dc.Sb,dc.pe];id.actualBounds=Cf;id.measuredBounds=zh;id.naturalBounds=ig;0===hg?Ie.assign(Cf):Ie.Rc(Cf);J.free(jd);J.free(Ke);M.free(Yj);nd.free(oe)}null!==le.Pg&&le.Pg.push(Ie);$b(rn,Ie.x,Ie.y,Ie.width,Ie.height)}cj(Cb,!1)}}};
Jm.prototype.arrange=function(a,b,c){if(null!==a.Pg){var d=a.pb(),e=a.ij;if(null!==e){var f=a.Pg,g=0,h=f[g];g++;null!==d&&d.arrange(h.x-c.x,h.y-c.y,h.width,h.height);for(var k=b.length,l=0;l<k;l++){var m=b[l];h=e[l];m.visible&&m!==d&&0!==h.length&&(h=f[g],g++,m.arrange(h.x-c.x,h.y-c.y,h.width,h.height))}a.Pg=null}}};
Jm.prototype.oc=function(a,b,c){var d=c.nj;c.nj=!0;var e=a.naturalBounds,f=e.width;e=e.height;b.save();b.beginPath();b.rect(-1,-1,f+1,e+1);b.clip();f=a.pb();f.oc(b,c);e=a.Af()*c.scale;0>=e&&(e=1);for(var g=f.actualBounds,h=a.T.m,k=a.ij,l=h.length,m=0;m<l;m++){var n=h[m],p=k[m],r=p.length;if(n.visible&&n!==f&&0!==p.length)if(n instanceof xf){if(!(2>a.graduatedTickUnit*n.interval*f.geometry.flattenedTotalLength/a.graduatedRange*e)){var q=n.measuredBounds,u=n.strokeWidth*n.scale,w=n.alignmentFocus;w.Ac()&&
(w=uc);for(var v=0;v<r;v++){var A=p[v].jm,y=p[v].angle,B=w,z=n.vb;z.reset();z.translate(A.x+g.x,A.y+g.y);z.rotate(y+n.angle,0,0);z.translate(-q.width*B.x+B.offsetX+u/2,-q.height*B.y+B.offsetY+u/2);z.scale(n.scale,n.scale);rl(n,!1);n.Nh.set(n.vb);n.Rk=n.scale;sl(n,!1);n.oc(b,c);n.vb.reset()}}}else if(n instanceof Lg)for(null===a.qh&&(a.qh=new Lg),q=a.qh,Km(q,n),n=0;n<r;n++)u=p[n],u.actualBounds&&u.measuredBounds&&u.naturalBounds&&(q.Xb=u.text||"",q.zb=u.pA||0,q.Yc=u.lineCount||0,w=u.lines,void 0!==
w&&(q.sb=w[0],q.ei=w[1],q.re=w[2],q.Ce=w[3],q.Dc=w[4],q.Sb=w[5],q.pe=w[6]),u.naturalBounds&&(q.uc=u.naturalBounds),u.actualBounds&&(w=u.actualBounds,q.arrange(w.x,w.y,w.width,w.height)),w=u.actualBounds,q.arrange(w.x,w.y,w.width,w.height),v=u.measuredBounds,u=u.naturalBounds,A=q.vb,A.reset(),A.translate(w.x+g.x,w.y+g.y),A.translate(-v.x,-v.y),q.mp(A,u.x,u.y,u.width,u.height),rl(q,!1),q.Nh.set(q.vb),q.Rk=q.scale,sl(q,!1),q.oc(b,c))}c.nj=d;b.restore();b.Ic(!0)};
function X(a,b){Y.call(this);this.ha=null;if(void 0===a)this.ha=X.Position;else if("string"===typeof a){var c=Dl.H(a);null!==c&&(this.ha=c)}else a instanceof El?this.ha=a:a&&(this.ha=X.Position,b=a);null===this.ha&&C("Panel type not specified or PanelLayout not loaded: "+a);this.T=new F;this.nb=oc;this.ha===X.Grid&&(this.G|=1048576);this.ln=Tc;this.Of=Ok;this.ha===X.Table&&Nm(this);this.Gp=qg;this.Jn=Kb;this.Kn=qb;this.Gn=0;this.Fn=100;this.In=10;this.Hn=0;this.Qh=this.jb=this.Rf=this.Pg=this.ij=
null;this.ao=NaN;this.ve=this.ci=null;this.fl="category";this.$d=null;this.ig=new M(NaN,NaN,NaN,NaN);this.qh=this.cp=this.ph=null;this.Re="";b&&Object.assign(this,b)}ma(X,Y);function Nm(a){a.dj=oc;a.Gg=1;a.Wh=null;a.Vh=null;a.Fg=1;a.Eg=null;a.Uh=null;a.ob=[];a.ib=[];a.Dj=Om;a.cj=Om;a.vi=0;a.gi=0}
X.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.ha=this.ha;a.nb=this.nb.I();a.ln=this.ln.I();a.Of=this.Of;if(a.ha===X.Table){a.dj=this.dj.I();a.Gg=this.Gg;a.Wh=this.Wh;a.Vh=this.Vh;a.Fg=this.Fg;a.Eg=this.Eg;a.Uh=this.Uh;var b=[];if(0<this.ob.length)for(var c=this.ob,d=c.length,e=0;e<d;e++)if(void 0!==c[e]){var f=c[e].copy();f.Si(a);b[e]=f}a.ob=b;b=[];if(0<this.ib.length)for(c=this.ib,d=c.length,e=0;e<d;e++)void 0!==c[e]&&(f=c[e].copy(),f.Si(a),b[e]=f);a.ib=b;a.Dj=
this.Dj;a.cj=this.cj;a.vi=this.vi;a.gi=this.gi}a.Gp=this.Gp;a.Jn=this.Jn.I();a.Kn=this.Kn.I();a.Gn=this.Gn;a.Fn=this.Fn;a.In=this.In;a.Hn=this.Hn;a.ij=this.ij;a.Rf=this.Rf;a.jb=this.jb;a.Qh=this.Qh;a.ao=this.ao;a.ci=this.ci;a.ve=this.ve;a.fl=this.fl;a.ig.assign(this.ig);a.Re=this.Re;null!==this.cp&&(a.cp=this.cp)};X.prototype.wf=function(a){Y.prototype.wf.call(this,a);a.T=this.T;for(var b=a.T.m,c=b.length,d=0;d<c;d++)b[d].bg=a;a.ph=null};
X.prototype.copy=function(){var a=Y.prototype.copy.call(this);if(null!==a){for(var b=this.T.m,c=b.length,d=0;d<c;d++){var e=b[d].copy();e.Si(a);e.Bj=null;var f=a.T,g=f.count;f.wb(g,e);f=a.part;if(null!==f){f.li=null;null!==e.portId&&f instanceof W&&(f.Je=!0);var h=a.diagram;null!==h&&h.undoManager.isUndoingRedoing||f.Wa(ie,"elements",a,null,e,null,g)}}return a}return null};t=X.prototype;t.toString=function(){return"Panel("+this.type.name+")#"+fb(this)};
t.Eo=function(a){Y.prototype.Eo.call(this,a);for(var b=this.T.m,c=b.length,d=0;d<c;d++)b[d].Eo(a)};
t.Ei=function(a,b){if(this.ha===X.Grid)a.Ed(),this.ha.oc(this,a,b);else if(this.ha===X.Graduated)a.Ed(),this.ha.oc(this,a,b);else{this.ha===X.Table&&(a.Ed(),a.lineCap="butt",Pm(this,a,!0,this.ob,!0),Pm(this,a,!1,this.ib,!0),Qm(this,a,!0,this.ob),Qm(this,a,!1,this.ib),Pm(this,a,!0,this.ob,!1),Pm(this,a,!1,this.ib,!1));var c=this.isClipping&&this.ha===X.Spot;c&&a.save();for(var d=this.pb(),e=this.T.m,f=e.length,g=0;g<f;g++){var h=e[g];c&&h===d&&(a.clipInsteadOfFill=!0);h.oc(a,b);c&&h===d&&(a.clipInsteadOfFill=
!1)}c&&(a.restore(),a.Ic(!0))}};
function Qm(a,b,c,d){for(var e=d.length,f=a.actualBounds,g=a.naturalBounds,h=!0,k=0;k<e;k++){var l=d[k];if(void 0!==l)if(h)h=!1;else if(0!==l.actual){if(c){if(l.position>f.height)continue}else if(l.position>f.width)continue;var m=l.separatorStrokeWidth;isNaN(m)&&(m=c?a.Gg:a.Fg);var n=l.separatorStroke;null===n&&(n=c?a.Wh:a.Eg);if(0!==m&&null!==n){ci(a,b,n,!1,!1,g,f);n=!1;var p=l.separatorDashArray;null===p&&(p=c?a.Vh:a.Uh);null!==p&&(n=!0,b.ns(p,0));b.beginPath();p=l.position+m;c?p>f.height&&(m-=
p-f.height):p>f.width&&(m-=p-f.width);l=l.position+m/2;b.lineWidth=m;m=a.nb;c?(l+=m.top,p=f.width-m.right,b.moveTo(m.left,l),b.lineTo(p,l)):(l+=m.left,p=f.height-m.bottom,b.moveTo(l,m.top),b.lineTo(l,p));b.stroke();n&&b.ls()}}}}
function Pm(a,b,c,d,e){for(var f=d.length,g=a.actualBounds,h=a.naturalBounds,k=0;k<f;k++){var l=d[k];if(void 0!==l&&null!==l.background&&l.coversSeparators!==e&&0!==l.actual){var m=c?g.height:g.width;if(!(l.position>m)){var n=l.Jc(),p=l.separatorStrokeWidth;isNaN(p)&&(p=c?a.Gg:a.Fg);var r=l.separatorStroke;null===r&&(r=c?a.Wh:a.Eg);null===r&&(p=0);n-=p;p=l.position+p;n+=l.actual;p+n>m&&(n=m-p);0>=n||(m=a.nb,ci(a,b,l.background,!0,!1,h,g),c?b.fillRect(m.left,p+m.top,g.width-(m.left+m.right),n):b.fillRect(p+
m.left,m.top,n,g.height-(m.top+m.bottom)))}}}}function Mj(a){return"LineV"===a||"BarV"===a}
t.Zj=function(a,b,c,d,e){var f=this.je(),g=this.transform,h=1/(g.m11*g.m22-g.m12*g.m21),k=g.m22*h,l=-g.m12*h,m=-g.m21*h,n=g.m11*h,p=h*(g.m21*g.dy-g.m22*g.dx),r=h*(g.m12*g.dx-g.m11*g.dy);if(null!==this.areaBackground)return g=this.actualBounds,L.Cf(g.left,g.top,g.right,g.bottom,a,b,c,d,e);if(null!==this.background)return f=a*k+b*m+p,h=a*l+b*n+r,a=c*k+d*m+p,k=c*l+d*n+r,e.h(0,0),c=this.naturalBounds,f=L.Cf(0,0,c.width,c.height,f,h,a,k,e),e.transform(g),f;f||(k=1,m=l=0,n=1,r=p=0);h=a*k+b*m+p;a=a*l+b*
n+r;k=c*k+d*m+p;c=c*l+d*n+r;e.h(k,c);d=(k-h)*(k-h)+(c-a)*(c-a);l=!1;n=this.T.m;r=n.length;m=J.alloc();p=null;b=Infinity;var q=null,u=this.isClipping&&this.ha===X.Spot;u&&(q=J.alloc(),p=this.pb(),(l=p.Zj(h,a,k,c,q))&&(b=(h-q.x)*(h-q.x)+(a-q.y)*(a-q.y)));for(var w=0;w<r;w++){var v=n[w];v.visible&&v!==p&&v.Zj(h,a,k,c,m)&&(l=!0,v=(h-m.x)*(h-m.x)+(a-m.y)*(a-m.y),v<d&&(d=v,e.set(m)))}u&&(b>d&&e.set(q),J.free(q));J.free(m);f&&e.transform(g);return l};
t.s=function(a){if(!hj(this)){Y.prototype.s.call(this,a);a=null;if(this.ha===X.Auto||this.ha===X.Link)a=this.pb();for(var b=this.T.m,c=b.length,d=0;d<c;d++){var e=b[d];(e===a||e.isPanelMain)&&e.s(!0);if(!e.desiredSize.u()){var f=bl(e,!1);(e instanceof mg||e instanceof X||e instanceof Lg||f!==og)&&e.s(!0)}}}};t.ak=function(){if(!hj(this)){cj(this,!0);cl(this,!0);for(var a=this.T.m,b=a.length,c=0;c<b;c++)a[c].ak()}};
t.bl=function(){if(0!==(this.G&2048)===!1){rl(this,!0);sl(this,!0);for(var a=this.T.m,b=a.length,c=0;c<b;c++)a[c].bv()}};t.bv=function(){sl(this,!0);for(var a=this.T.m,b=a.length,c=0;c<b;c++)a[c].bv()};
t.gm=function(a,b,c,d){var e=this.ig;e.h(0,0,0,0);var f=this.desiredSize,g=this.minSize;void 0===c&&(c=g.width,d=g.height);c=Math.max(c,g.width);d=Math.max(d,g.height);var h=this.maxSize;isNaN(f.width)||(a=Math.min(f.width,h.width));isNaN(f.height)||(b=Math.min(f.height,h.height));a=Math.max(c,a);b=Math.max(d,b);var k=this.nb;a=Math.max(a-k.left-k.right,0);b=Math.max(b-k.top-k.bottom,0);var l=this.T.m;0!==l.length&&this.ha.measure(this,a,b,l,e,c,d);a=e.width+k.left+k.right;k=e.height+k.top+k.bottom;
isFinite(f.width)&&(a=f.width);isFinite(f.height)&&(k=f.height);a=Math.min(h.width,a);k=Math.min(h.height,k);a=Math.max(g.width,a);k=Math.max(g.height,k);a=Math.max(c,a);k=Math.max(d,k);Qb(e,a,k);Qb(this.naturalBounds,a,k);this.xe(0,0,a,k)};t.pb=function(){if(null===this.ph){var a=this.T.m,b=a.length;if(0===b)return null;for(var c=0;c<b;c++){var d=a[c];if(!0===d.isPanelMain)return this.ph=d}this.ph=a[0]}return this.ph};function mm(a){return null!==a.part?a.part.locationObject:null}
t.zh=function(a,b,c,d){var e=this.T.m;this.actualBounds.h(a,b,c,d);if(0!==e.length){if(!this.desiredSize.u()){a=bl(this,!0);var f=this.measuredBounds;b=f.width;f=f.height;var g=this.Ug,h=g.left+g.right;g=g.top+g.bottom;b===c&&f===d&&(a=og);switch(a){case og:if(b>c||f>d)this.s(),this.measure(b>c?c:b,f>d?d:f,0,0);break;case pd:this.s(!0);this.measure(c+h,d+g,0,0);break;case Pk:this.s(!0);this.measure(c+h,f+g,0,0);break;case Qk:this.s(!0),this.measure(b+h,d+g,0,0)}}this.ha.arrange(this,e,this.ig)}};
t.Bh=function(a){var b=this.naturalBounds,c=mm(this);if(ac(0,0,b.width,b.height,a.x,a.y)){b=this.T.m;for(var d=b.length,e=J.allocAt(0,0);d--;){var f=b[d];if(f.visible||f===c)if(yb(e.set(a),f.transform),f.$(e))return J.free(e),!0}J.free(e);return null===this.Ub&&null===this.jd?!1:!0}return!1};t.os=function(a){if(this.Ck===a)return this;for(var b=this.T.m,c=b.length,d=0;d<c;d++){var e=b[d].os(a);if(null!==e)return e}return null};
t.Cm=function(a,b){b(this,a);if(a instanceof X){a=a.T.m;for(var c=a.length,d=0;d<c;d++)this.Cm(a[d],b)}};function uj(a,b){Rm(a,a,b)}function Rm(a,b,c){c(b);b=b.T.m;for(var d=b.length,e=0;e<d;e++){var f=b[e];f instanceof X&&Rm(a,f,c)}}function Sm(a,b){Tm(a,a,b)}function Tm(a,b,c){c(b);if(b instanceof X){b=b.T.m;for(var d=b.length,e=0;e<d;e++)Tm(a,b[e],c)}}t.Yl=function(a){return Um(this,this,a)};
function Um(a,b,c){if(c(b))return b;if(b instanceof X){b=b.T.m;for(var d=b.length,e=0;e<d;e++){var f=Um(a,b[e],c);if(null!==f)return f}}return null}t.Ya=function(a){if(this.name===a)return this;var b=this.T.m,c=b.length;null===this.ci&&null===this.ve||(c=Vm(this));for(var d=0;d<c;d++){var e=b[d];if(e instanceof X){var f=e.Ya(a);if(null!==f)return f}if(e.name===a)return e}return null};
function Wm(a){a=a.T.m;for(var b=a.length,c=0,d=0;d<b;d++){var e=a[d];e instanceof X?c=Math.max(c,Wm(e)):e instanceof xf&&(c=Math.max(c,e.hg/2*e.Ij*e.Af()))}return c}t.je=function(){return!(this.type===X.TableRow||this.type===X.TableColumn)};
t.Zb=function(a,b,c){if(!1===this.pickable)return null;void 0===b&&(b=null);void 0===c&&(c=null);if(ij(this))return null;var d=this.naturalBounds,e=1/this.Af(),f=this.je(),g=f?a:yb(J.allocAt(a.x,a.y),this.transform),h=this.diagram,k=10,l=5;null!==h&&(k=h.am("extraTouchArea"),l=k/2);if(ac(-(l*e),-(l*e),d.width+k*e,d.height+k*e,g.x,g.y)){if(!this.isAtomic){e=this.T.m;var m=e.length;h=J.alloc();l=(k=this.isClipping&&this.ha===X.Spot)?this.pb():null;if(k&&(l.je()?yb(h.set(a),l.transform):h.set(a),!l.$(h)))return J.free(h),
f||J.free(g),null;for(var n=mm(this);m--;){var p=e[m];if(p.visible||p===n)if(p.je()?yb(h.set(a),p.transform):h.set(a),!k||p!==l){var r=null;p instanceof X?r=p.Zb(h,b,c):!0===p.pickable&&p.$(h)&&(r=p);if(null!==r&&(null!==b&&(r=b(r)),null!==r&&(null===c||c(r))))return J.free(h),f||J.free(g),r}}J.free(h)}if(null===this.background&&null===this.areaBackground)return f||J.free(g),null;a=ac(0,0,d.width,d.height,g.x,g.y)?this:null;f||J.free(g);return a}f||J.free(g);return null};
t.Hi=function(a,b,c,d){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var e=this.naturalBounds,f=this.je(),g=f?a:yb(J.allocAt(a.x,a.y),this.transform);e=ac(0,0,e.width,e.height,g.x,g.y);if(this.type===X.TableRow||this.type===X.TableColumn||e){if(!this.isAtomic){for(var h=this.T.m,k=h.length,l=J.alloc(),m=mm(this);k--;){var n=h[k];if(n.visible||n===m){n.je()?yb(l.set(a),n.transform):l.set(a);var p=n;n=n instanceof X?n:null;(null!==n?n.Hi(l,b,c,d):p.$(l))&&!1!==p.pickable&&
(null!==b&&(p=b(p)),null===p||null!==c&&!c(p)||d.add(p))}}J.free(l)}f||J.free(g);return e&&(null!==this.background||null!==this.areaBackground)}f||J.free(g);return!1};
t.zf=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var g=f;void 0===f&&(g=nd.alloc(),g.reset());g.multiply(this.transform);if(this.Ah(a,g))return Xm(this,b,c,e),void 0===f&&nd.free(g),!0;if(this.Mc(a,g)){if(!this.isAtomic)for(var h=mm(this),k=this.T.m,l=k.length;l--;){var m=k[l];if(m.visible||m===h){var n=m.actualBounds,p=this.naturalBounds;if(!(n.x>p.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=m;m=m instanceof X?m:null;p=nd.alloc();p.set(g);
if(null!==m?m.zf(a,b,c,d,e,p):al(n,a,d,p))null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||e.add(n);nd.free(p)}}}void 0===f&&nd.free(g);return d}void 0===f&&nd.free(g);return!1};function Xm(a,b,c,d){for(var e=a.T.m,f=e.length;f--;){var g=e[f];if(g.visible){var h=g.actualBounds,k=a.naturalBounds;h.x>k.width||h.y>k.height||0>h.x+h.width||0>h.y+h.height||(g instanceof X&&Xm(g,b,c,d),null!==b&&(g=b(g)),null===g||null!==c&&!c(g)||d.add(g))}}}
t.pg=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===c&&(c=null);void 0===d&&(d=null);var g=this.naturalBounds,h=this.je(),k=h?a:yb(J.allocAt(a.x,a.y),this.transform),l=h?b:yb(J.allocAt(b.x,b.y),this.transform),m=k.xf(l),n=0<k.x&&k.x<g.width&&0<k.y&&k.y<g.height||zb(k.x,k.y,0,0,0,g.height)<=m||zb(k.x,k.y,0,g.height,g.width,g.height)<=m||zb(k.x,k.y,g.width,g.height,g.width,0)<=m||zb(k.x,k.y,g.width,0,0,0)<=m;g=k.qd(0,0)<=m&&k.qd(0,g.height)<=m&&k.qd(g.width,0)<=m&&k.qd(g.width,g.height)<=
m;h||(J.free(k),J.free(l));if(n){if(!this.isAtomic){k=J.alloc();l=J.alloc();m=mm(this);for(var p=this.T.m,r=p.length;r--;){var q=p[r];if(q.visible||q===m){var u=q.actualBounds,w=this.naturalBounds;if(!h||!(u.x>w.width||u.y>w.height||0>u.x+u.width||0>u.y+u.height))if(q.je()?(u=q.transform,yb(k.set(a),u),yb(l.set(b),u)):(k.set(a),l.set(b)),u=q,q=q instanceof X?q:null,null!==q?q.pg(k,l,c,d,e,f):u.Ox(k,l,e))null!==c&&(u=c(u)),null===u||null!==d&&!d(u)||f.add(u)}}J.free(k);J.free(l)}return e?n:g}return!1};
function sm(a){var b=null;a instanceof xf&&(b=a.spot1,b===Tc&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot1));null===b&&(b=tc);return b}function tm(a){var b=null;a instanceof xf&&(b=a.spot2,b===Tc&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot2));null===b&&(b=Bc);return b}t.add=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];for(c=0;c<b.length;c++)this.wb(this.T.count,b[c]);return this};t.J=function(a){return this.T.J(a)};
t.wb=function(a,b){b instanceof V&&C("Cannot add a Part to a Panel: "+b+"; use a Panel instead");if(this===b||this.rg(b))this===b&&C("Cannot make a Panel contain itself: "+this.toString()),C("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+b.toString());var c=b.panel;null!==c&&c!==this&&C("Cannot add a GraphObject that already belongs to another Panel to this Panel: "+b.toString()+", already contained by "+c.toString()+", cannot be shared by this Panel: "+this.toString());
this.ha!==X.Grid||b instanceof xf||C("Can only add Shapes to a Grid Panel, not: "+b);this.ha!==X.Graduated||b instanceof xf||b instanceof Lg||C("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+b);b.Si(this);b.Bj=null;if(null!==this.itemArray){var d=b.data;null!==d&&"object"===typeof d&&(null===this.$d&&(this.$d=new I),this.$d.add(d,b))}var e=this.T;d=-1;if(c===this){for(var f=-1,g=this.T.m,h=g.length,k=0;k<h;k++)if(g[k]===b){f=k;break}if(-1!==f){if(f===a||f+1>=e.count&&a>=e.count)return;
e.eb(f);d=f}else C("element "+b.toString()+" has panel "+c.toString()+" but is not contained by it.")}if(0>a||a>e.count)a=e.count;e.wb(a,b);if(0===a||b.isPanelMain)this.ph=null;hj(this)||this.s();b.s(!1);null!==b.portId?this.Je=!0:b instanceof X&&!0===b.Je&&(this.Je=!0);this.Rf=null;this.Ef()||Ym(this,b,!1);c=this.part;null!==c&&(c.li=null,c.Xf=NaN,this.Je&&c instanceof W&&(c.Je=!0),c.Je&&c instanceof W&&(c.nc=null),e=this.diagram,null!==e&&e.undoManager.isUndoingRedoing||(-1!==d&&c.Wa(pe,"elements",
this,b,null,d,null),c.Wa(ie,"elements",this,null,b,null,a)))};function Zm(a,b){a.G=b?a.G|16777216:a.G&-16777217}t.remove=function(a){for(var b=this.T.m,c=b.length,d=-1,e=0;e<c;e++)if(b[e]===a){d=e;break}-1!==d&&this.ec(d,!0)};t.eb=function(a){0<=a&&this.ec(a,!0)};
t.ec=function(a,b){var c=this.T,d=c.J(a);d.Bj=null;d.Si(null);if(null!==this.$d){var e=d.data;"object"===typeof e&&this.$d.remove(e)}c.eb(a);cj(this,!1);this.s();this.ph===d&&(this.ph=null);this.Rf=null;var f=this.part;null!==f&&(f.li=null,f.Xf=NaN,f.Lb(),f instanceof W&&(d instanceof X?d.Cm(d,function(a,c){Il(f,c,b)}):Il(f,d,b)),c=this.diagram,null!==c&&c.undoManager.isUndoingRedoing||f.Wa(pe,"elements",this,d,null,a,null))};
X.prototype.getRowDefinition=function(a){0>a&&xa(a,">= 0",X,"getRowDefinition:idx");a=Math.round(a);var b=this.ob;if(void 0===b)return null;if(void 0===b[a]){var c=new Ij;c.Si(this);c.isRow=!0;c.index=a;b[a]=c;this.Wa(ie,"rowdefs",this,null,c,null,a)}return b[a]};
X.prototype.KA=function(a){0>a&&xa(a,">= 0",X,"removeRowDefinition:idx");a=Math.round(a);var b=this.ob;if(void 0!==b){var c=b[a];if(c){b[a]=void 0;for(var d=b.length-1;0<=d&&void 0===b[d--];)b.length--;this.Wa(pe,"rowdefs",this,c,null,a,null);this.s()}}};function Jj(a,b,c){var d=a.ob;if(d&&!(0>b)){d[b]=c instanceof Ij?c:void 0;if(!c)for(b=d.length-1;0<=b&&void 0===d[b--];)d.length--;a.s()}}
X.prototype.getColumnDefinition=function(a){0>a&&xa(a,">= 0",X,"getColumnDefinition:idx");a=Math.round(a);var b=this.ib;if(void 0===b)return null;if(void 0===b[a]){var c=new Ij;c.Si(this);c.isRow=!1;c.index=a;b[a]=c;this.Wa(ie,"coldefs",this,null,c,null,a)}return b[a]};t=X.prototype;
t.FA=function(a){0>a&&xa(a,">= 0",X,"removeColumnDefinition:idx");a=Math.round(a);var b=this.ib;if(void 0!==b){var c=b[a];if(c){b[a]=void 0;for(var d=b.length-1;0<=d&&void 0===b[d--];)b.length--;this.Wa(pe,"coldefs",this,c,null,a,null);this.s()}}};function Kj(a,b,c){var d=a.ib;if(d&&!(0>b)){d[b]=c instanceof Ij?c:void 0;if(!c)for(b=d.length-1;0<=b&&void 0===d[b--];)d.length--;a.s()}}
t.Mz=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.ob,d=c.length,e=this.vi;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};t.Ez=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.ib,d=c.length,e=this.gi;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};
t.cA=function(a,b){void 0===b&&(b=new J(NaN,NaN));if(this.type!==X.Graduated)return b.h(NaN,NaN),b;a=Math.min(Math.max(a,this.graduatedMin),this.graduatedMax);var c=this.pb();c.geometry.Tu((a-this.graduatedMin)/this.graduatedRange,b);return c.transform.Aa(b)};t.dA=function(a){if(this.type!==X.Graduated)return NaN;var b=this.pb();b.transform.Hd(a);return b.geometry.Sx(a)*this.graduatedRange+this.graduatedMin};function zl(a){a=a.Qh;return null!==a&&a.v}
function ng(a){var b=a.Qh;if(null===b)null!==a.data&&C("Template cannot have .data be non-null: "+a),a.Qh=b=new F;else if(b.v)return;var c=new F;Zm(a,!1);a.Cm(a,function(a,d){var e=d.fb;if(null!==e)for(wl(d,!1),e=e.iterator;e.next();){var f=e.value;f.mode===$m&&wl(d,!0);var g=f.sourceName;null!==g&&("/"===g&&Zm(a,!0),g=$k(f,a,d),null!==g&&(c.add(g),null===g.Hl&&(g.Hl=new F),g.Hl.add(f)));b.add(f)}if(d instanceof X&&d.type===X.Table){if(0<d.ob.length)for(a=d.ob,e=a.length,f=0;f<e;f++)if(g=a[f],void 0!==
g&&null!==g.fb)for(var h=g.fb.iterator;h.next();){var k=h.value;k.pd=g;k.xp=2;k.Nl=g.index;b.add(k)}if(0<d.ib.length)for(d=d.ib,a=d.length,e=0;e<a;e++)if(f=d[e],void 0!==f&&null!==f.fb)for(g=f.fb.iterator;g.next();)h=g.value,h.pd=f,h.xp=1,h.Nl=f.index,b.add(h)}});for(var d=c.iterator;d.next();){var e=d.value;if(null!==e.Hl){wl(e,!0);for(var f=e.Hl.iterator;f.next();){var g=f.value;null===e.fb&&(e.fb=new F);e.fb.add(g)}}e.Hl=null}for(d=b.iterator;d.next();)if(e=d.value,f=e.pd,null!==f){e.pd=null;var h=
e.targetProperty,k=h.indexOf(".");0<k&&f instanceof X&&(g=h.substring(0,k),h=h.substr(k+1),k=f.Ya(g),null!==k?(f=k,e.targetProperty=h):ya('Warning: unable to find GraphObject named "'+g+'" for Binding: '+e.toString()));f instanceof Ij?(g=fb(f.panel),e.Xi=void 0===g?-1:g,f.panel.Ck=e.Xi):f instanceof Y?(g=fb(f),e.Xi=void 0===g?-1:g,f.Ck=e.Xi):C("Unknown type of binding target: "+f)}b.freeze();a instanceof V&&a.Nc()&&a.Ta()}
t.qz=function(a){void 0===a&&(a=!1);var b=this.copy();Sm(b,function(a){a instanceof X&&(a.Qh=null,a.jb=null);var b=a.fb;null!==b&&(a.fb=null,b.each(function(b){a.bind(b.copy())}));b=a.wg;null!==b&&(a.wg=null,b.each(function(b){a.Rv(b.value.copy())}))});a&&ng(b);return b};
t.Fa=function(a){var b=this.Qh;if(null!==b)for(void 0===a&&(a=""),b=b.iterator;b.next();){var c=b.value,d=c.sourceProperty;if(""===a||""===d||d===a)if(d=c.targetProperty,null!==c.converter||""!==d){d=this.data;var e=c.sourceName;if(null!==e)if(""===e)d=this;else if("/"===e)d=this;else if("."===e)d=this;else if(".."===e)d=this;else{if(d=this.Ya(e),null===d)continue}else if(c.isToModel)if(d=this.diagram,null!==d)d=d.model.modelData;else continue;var f=this,g=c.Xi;if(-1!==g){if(f=this.os(g),null===f)continue}else null!==
c.pd&&(f=c.pd);"/"===e?d=f.part:"."===e?d=f:".."===e&&(d=f.panel);e=c.xp;if(0!==e){if(!(f instanceof X))continue;1===e?f=f.getColumnDefinition(c.Nl):2===e&&(f=f.getRowDefinition(c.Nl))}void 0!==f&&c.Vv(f,d)}}};t.Nx=function(a){return void 0===a||null===a||null===this.$d?null:this.$d.H(a)};
function an(a,b){a=a.T.m;for(var c=a.length,d=b.length,e=0,f=null;e<c&&!(f=a[e],f instanceof X&&null!==f.data);)e++,f=a[e];if(c-e!==d)return!0;if(null===f)return 0<d;for(var g=0;e<c&&g<d;){f=a[e];if(!(f instanceof X)||f.data!==b[g])return!0;e++;g++}return!1}
function Vm(a){if(a.type===X.Spot||a.type===X.Auto)return Math.min(a.T.length,1);if(a.type===X.Link){a=a.T;for(var b=a.length,c=0;c<b;c++){var d=a.J(c);if(!(d instanceof xf&&d.isPanelMain))break}return c}return a.type===X.Table&&0<a.T.length&&(a=a.T.J(0),a.isPanelMain&&a instanceof X&&(a.type===X.TableRow||a.type===X.TableColumn))?1:0}t.xv=function(){for(var a=Vm(this);this.T.length>a;)this.ec(this.T.length-1,!1);bn(this,this.itemArray)};
function bn(a,b){var c=Vm(a);if(null===b||0===b.length)for(;a.T.length>c;)a.ec(a.T.length-1,!1);else if(a.T.length<=c){c=b.length;for(var d=0;d<c;d++)cn(a,b[d],d,!0)}else{d=c;for(var e=0;e<b.length;e++,d++){var f=b[e],g=d<a.T.length?a.T.J(d):null;if(g instanceof X){if(g.data!==f){var h=dn(a,g.data),k=dn(a,f),l=k!==h;l||(h=en(a,h),l=en(a,k)!==h);l?(a.ec(d,!1),cn(a,f,e,!1)):g.data=f}}else cn(a,f,e,!1)}for(;d<a.T.length;)a.ec(d,!1);a.ph=null;fn(a,c,0);hj(a)||a.s();a.Rf=null;a.Ef()||Ym(a,a,!1);b=a.part;
null!==b&&(b.li=null,b.Xf=NaN,a.Je&&b instanceof W&&(b.Je=!0),b.Je&&b instanceof W&&(b.nc=null))}}function cn(a,b,c,d){if(!(void 0===b||null===b||0>c)){var e=dn(a,b);e=en(a,e);if(null!==e){ng(e);e=e.copy();if(0!==(e.G&16777216)){var f=a.Ch();null!==f&&Zm(f,!0)}"object"===typeof b&&(null===a.$d&&(a.$d=new I),a.$d.add(b,e));f=c+Vm(a);a.wb(f,e);d&&(e.jb=b,fn(a,f,c),e.jb=null);e.data=b}}}
function fn(a,b,c){for(a=a.T;b<a.length;){var d=a.J(b);if(d instanceof X){var e=b,f=c;d.type===X.TableRow?d.row=e:d.type===X.TableColumn&&(d.column=e);d.itemIndex=f}b++;c++}}function dn(a,b){if(null===b)return"";a=a.fl;if("function"===typeof a)a=a(b);else if("string"===typeof a&&"object"===typeof b){if(""===a)return"";a=gn(b,a)}else return"";if(void 0===a)return"";if("string"===typeof a)return a;C("Panel.getCategoryForItemData found a non-string category for "+b+": "+a)}
function en(a,b){var c=a.itemTemplateMap,d=null;null!==c&&(d=c.H(b));null===d&&(null!==c&&(d=c.H("")),null===d&&(hn||(hn=!0,ya('No item template Panel found for category "'+b+'" on '+a),ya("  Using default item template."),a=new X,b=new Lg,b.bind(new si("text","",La)),a.add(b),jn=a),d=jn));return d}function Ym(a,b,c){var d=b.enabledChanged;null!==d&&d(b,c);if(b instanceof X){b=b.T.m;d=b.length;for(var e=0;e<d;e++){var f=b[e];c&&f instanceof X&&!f.isEnabled||Ym(a,f,c)}}}
function kn(a,b){b.name=a;Dl.add(a,b)}
na.Object.defineProperties(X.prototype,{type:{get:function(){return this.ha},set:function(a){var b=this.ha;b!==a&&(this.ha=a,this.ha===X.Grid?this.isAtomic=!0:this.ha===X.Table&&Nm(this),this.s(),this.g("type",b,a))}},elements:{get:function(){return this.T.iterator}},naturalBounds:{get:function(){return this.uc}},padding:{get:function(){return this.nb},set:function(a){"number"===
typeof a?(0>a&&xa(a,">= 0",X,"padding"),a=new kc(a)):(0>a.left&&xa(a.left,">= 0",X,"padding:value.left"),0>a.right&&xa(a.right,">= 0",X,"padding:value.right"),0>a.top&&xa(a.top,">= 0",X,"padding:value.top"),0>a.bottom&&xa(a.bottom,">= 0",X,"padding:value.bottom"));var b=this.nb;b.A(a)||(this.nb=a=a.I(),this.s(),this.g("padding",b,a))}},defaultAlignment:{get:function(){return this.ln},set:function(a){var b=this.ln;b.A(a)||(this.ln=a=a.I(),this.s(),this.g("defaultAlignment",
b,a))}},defaultStretch:{get:function(){return this.Of},set:function(a){var b=this.Of;b!==a&&(this.Of=a,this.s(),this.g("defaultStretch",b,a))}},defaultSeparatorPadding:{get:function(){return void 0===this.dj?oc:this.dj},set:function(a){if(void 0!==this.dj){"number"===typeof a&&(a=new kc(a));var b=this.dj;b.A(a)||(this.dj=a=a.I(),this.s(),this.g("defaultSeparatorPadding",b,a))}}},defaultRowSeparatorStroke:{get:function(){return void 0===
this.Wh?null:this.Wh},set:function(a){var b=this.Wh;b!==a&&(null===a||"string"===typeof a||a instanceof gl)&&(a instanceof gl&&a.freeze(),this.Wh=a,this.N(),this.g("defaultRowSeparatorStroke",b,a))}},defaultRowSeparatorStrokeWidth:{get:function(){return void 0===this.Gg?1:this.Gg},set:function(a){if(void 0!==this.Gg){var b=this.Gg;b!==a&&isFinite(a)&&0<=a&&(this.Gg=a,this.s(),this.g("defaultRowSeparatorStrokeWidth",b,a))}}},defaultRowSeparatorDashArray:{
get:function(){return void 0===this.Vh?null:this.Vh},set:function(a){if(void 0!==this.Vh){var b=this.Vh;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||C("defaultRowSeparatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.Vh=a;this.N();this.g("defaultRowSeparatorDashArray",b,a)}}}},defaultColumnSeparatorStroke:{get:function(){return void 0===
this.Eg?null:this.Eg},set:function(a){if(void 0!==this.Eg){var b=this.Eg;b!==a&&(null===a||"string"===typeof a||a instanceof gl)&&(a instanceof gl&&a.freeze(),this.Eg=a,this.N(),this.g("defaultColumnSeparatorStroke",b,a))}}},defaultColumnSeparatorStrokeWidth:{get:function(){return void 0===this.Fg?1:this.Fg},set:function(a){if(void 0!==this.Fg){var b=this.Fg;b!==a&&isFinite(a)&&0<=a&&(this.Fg=a,this.s(),this.g("defaultColumnSeparatorStrokeWidth",b,a))}}},defaultColumnSeparatorDashArray:{
get:function(){return void 0===this.Uh?null:this.Uh},set:function(a){if(void 0!==this.Uh){var b=this.Uh;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||C("defaultColumnSeparatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.Uh=a;this.N();this.g("defaultColumnSeparatorDashArray",b,a)}}}},viewboxStretch:{get:function(){return this.Gp},
set:function(a){var b=this.Gp;b!==a&&(this.Gp=a,this.s(),this.g("viewboxStretch",b,a))}},gridCellSize:{get:function(){return this.Jn},set:function(a){var b=this.Jn;if(!b.A(a)){a.u()&&0!==a.width&&0!==a.height||C("Invalid Panel.gridCellSize: "+a);this.Jn=a.I();var c=this.diagram;null!==c&&this===c.grid&&dj(c);this.N();this.g("gridCellSize",b,a)}}},gridOrigin:{get:function(){return this.Kn},set:function(a){var b=this.Kn;if(!b.A(a)){a.u()||
C("Invalid Panel.gridOrigin: "+a);this.Kn=a.I();var c=this.diagram;null!==c&&this===c.grid&&dj(c);this.N();this.g("gridOrigin",b,a)}}},graduatedMin:{get:function(){return this.Gn},set:function(a){var b=this.Gn;b!==a&&(this.Gn=a,this.s(),this.g("graduatedMin",b,a),Yk(this)&&(a=this.part,null!==a&&Zk(this,a,"graduatedRange")))}},graduatedMax:{get:function(){return this.Fn},set:function(a){var b=this.Fn;b!==a&&(this.Fn=a,this.s(),this.g("graduatedMax",
b,a),Yk(this)&&(a=this.part,null!==a&&Zk(this,a,"graduatedRange")))}},graduatedRange:{get:function(){return this.graduatedMax-this.graduatedMin}},graduatedTickUnit:{get:function(){return this.In},set:function(a){var b=this.In;b!==a&&0<a&&(this.In=a,this.s(),this.g("graduatedTickUnit",b,a))}},graduatedTickBase:{get:function(){return this.Hn},set:function(a){var b=this.Hn;b!==a&&(this.Hn=a,this.s(),this.g("graduatedTickBase",
b,a))}},Je:{get:function(){return 0!==(this.G&8388608)},set:function(a){0!==(this.G&8388608)!==a&&(this.G^=8388608)}},rowCount:{get:function(){return void 0===this.ob?0:this.ob.length}},columnCount:{get:function(){return void 0===this.ib?0:this.ib.length}},rowSizing:{get:function(){return void 0===this.Dj?Om:this.Dj},set:function(a){if(void 0!==this.Dj){var b=this.Dj;b!==a&&(this.Dj=
a,this.s(),this.g("rowSizing",b,a))}}},columnSizing:{get:function(){return void 0===this.cj?Om:this.cj},set:function(a){if(void 0!==this.cj){var b=this.cj;b!==a&&(this.cj=a,this.s(),this.g("columnSizing",b,a))}}},topIndex:{get:function(){return void 0===this.vi?0:this.vi},set:function(a){if(void 0!==this.vi){var b=this.vi;b!==a&&((!isFinite(a)||0>a)&&C("Panel.topIndex must be greater than zero and a real number, not: "+a),this.vi=a,this.s(),
this.g("topIndex",b,a))}}},leftIndex:{get:function(){return void 0===this.gi?0:this.gi},set:function(a){if(void 0!==this.gi){var b=this.gi;b!==a&&((!isFinite(a)||0>a)&&C("Panel.leftIndex must be greater than zero and a real number, not: "+a),this.gi=a,this.s(),this.g("leftIndex",b,a))}}},data:{get:function(){return this.jb},set:function(a){var b=this.jb;if(b!==a){var c=this instanceof V&&!(this instanceof ye);ng(this);this.jb=a;var d=this.diagram;
null!==d&&(c?(c=d.partManager,this instanceof T?(null!==b&&c.Ue.remove(b),null!==a&&c.Ue.add(a,this)):this instanceof V&&(null!==b&&c.Ve.remove(b),null!==a&&c.Ve.add(a,this))):(c=this.panel,null!==c&&null!==c.$d&&(null!==b&&c.$d.remove(b),null!==a&&c.$d.add(a,this))));this.g("data",b,a);null!==d&&d.undoManager.isUndoingRedoing||null!==a&&this.Fa()}}},itemIndex:{get:function(){return this.ao},set:function(a){var b=this.ao;b!==a&&(this.ao=a,this.g("itemIndex",b,a))}},itemArray:{
get:function(){return this.ci},set:function(a){var b=this.ci;if(b!==a||null!==a&&an(this,a)){var c=this.diagram;b!==a&&(null!==c&&null!==b&&zj(c.partManager,this,c),this.ci=a,null!==c&&null!==a&&wj(c.partManager,this));this.g("itemArray",b,a);null!==c&&c.undoManager.isUndoingRedoing||bn(this,a)}}},itemTemplate:{get:function(){return null===this.ve?null:this.ve.H("")},set:function(a){if(null===this.ve){if(null===a)return;this.ve=new I}var b=this.ve.H("");
b!==a&&((a instanceof V||a.isPanelMain)&&C("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+a),this.ve.add("",a),this.g("itemTemplate",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.xv())}},itemTemplateMap:{get:function(){return this.ve},set:function(a){var b=this.ve;if(b!==a){for(var c=a.iterator;c.next(););this.ve=a;this.g("itemTemplateMap",b,a);a=this.diagram;null!==a&&a.undoManager.isUndoingRedoing||this.xv()}}},itemCategoryProperty:{
get:function(){return this.fl},set:function(a){var b=this.fl;b!==a&&(this.fl=a,this.g("itemCategoryProperty",b,a))}},isAtomic:{get:function(){return 0!==(this.G&1048576)},set:function(a){var b=0!==(this.G&1048576);b!==a&&(this.G^=1048576,this.g("isAtomic",b,a))}},isClipping:{get:function(){return 0!==(this.G&2097152)},set:function(a){var b=0!==(this.G&2097152);b!==a&&(this.G^=2097152,this instanceof U&&(this.$a=null),this.s(),
this.g("isClipping",b,a))}},isOpposite:{get:function(){return 0!==(this.G&33554432)},set:function(a){var b=0!==(this.G&33554432);b!==a&&(this.G^=33554432,this.s(),this.g("isOpposite",b,a))}},isEnabled:{get:function(){return 0!==(this.G&4194304)},set:function(a){var b=0!==(this.G&4194304);if(b!==a){var c=null===this.panel||this.panel.Ef();this.G^=4194304;this.g("isEnabled",b,a);b=this.diagram;null!==b&&b.undoManager.isUndoingRedoing||c&&Ym(this,
this,a)}}},alignmentFocusName:{get:function(){return this.Re},set:function(a){var b=this.Re;b!==a&&(this.Re=a,this.s(),this.g("alignmentFocusName",b,a))}}});
na.Object.defineProperties(X,{Position:{get:function(){return Dl.H("Position")}},Horizontal:{get:function(){return Dl.H("Horizontal")}},Vertical:{get:function(){return Dl.H("Vertical")}},Spot:{get:function(){return Dl.H("Spot")}},Auto:{get:function(){return Dl.H("Auto")}},Table:{get:function(){return Dl.H("Table")}},Viewbox:{
get:function(){return Dl.H("Viewbox")}},TableRow:{get:function(){return Dl.H("TableRow")}},TableColumn:{get:function(){return Dl.H("TableColumn")}},Link:{get:function(){return Dl.H("Link")}},Grid:{get:function(){return Dl.H("Grid")}},Graduated:{get:function(){return Dl.H("Graduated")}}});X.prototype.rebuildItemElements=X.prototype.xv;
X.prototype.findItemPanelForData=X.prototype.Nx;X.prototype.updateTargetBindings=X.prototype.Fa;X.prototype.copyTemplate=X.prototype.qz;X.prototype.graduatedValueForPoint=X.prototype.dA;X.prototype.graduatedPointForValue=X.prototype.cA;X.prototype.findColumnForLocalX=X.prototype.Ez;X.prototype.findRowForLocalY=X.prototype.Mz;X.prototype.removeColumnDefinition=X.prototype.FA;X.prototype.removeRowDefinition=X.prototype.KA;X.prototype.removeAt=X.prototype.eb;X.prototype.remove=X.prototype.remove;
X.prototype.insertAt=X.prototype.wb;X.prototype.elt=X.prototype.J;X.prototype.add=X.prototype.add;X.prototype.findObject=X.prototype.Ya;X.prototype.findInVisualTree=X.prototype.Yl;X.prototype.walkVisualTreeFrom=X.prototype.Cm;X.prototype.findMainElement=X.prototype.pb;var hn=!1,jn=null,Dl=new I;X.className="Panel";X.definePanelLayout=kn;kn("Position",new lm);kn("Vertical",new om);kn("Auto",new rm);kn("Link",new Cm);
function Ij(){Ua(this);this.bg=null;this.nr=!0;this.Ra=0;this.vc=NaN;this.wj=0;this.vj=Infinity;this.yb=Tc;this.ja=this.cc=this.la=0;this.fb=null;this.pp=ln;this.Ee=Ok;this.kp=this.eg=null;this.lp=NaN;this.Ub=this.Hj=null;this.gn=!1}
Ij.prototype.copy=function(){var a=new Ij;a.nr=this.nr;a.Ra=this.Ra;a.vc=this.vc;a.wj=this.wj;a.vj=this.vj;a.yb=this.yb;a.la=this.la;a.cc=this.cc;a.ja=this.ja;a.Ee=this.Ee;a.pp=this.pp;null===this.eg?a.eg=null:a.eg=this.eg.I();a.kp=this.kp;a.lp=this.lp;a.Hj=null;null!==this.Hj&&(a.separatorDashArray=Ba(this.separatorDashArray));a.Ub=this.Ub;a.gn=this.gn;a.fb=this.fb;return a};t=Ij.prototype;t.gb=function(a){a.classType===Ij&&(this.sizing=a)};
t.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+fb(this)};t.Si=function(a){this.bg=a};
t.Cu=function(){var a=0,b=0,c=this.bg,d=this.isRow;if(null!==c&&c.type===X.Table)for(var e=d?c.ob.length:c.ib.length,f=0;f<e;f++){var g=d?c.ob[f]:c.ib[f];if(void 0!==g){b=g.index;break}}this.index!==b&&(b=this.separatorStroke,null===b&&null!==c&&(b=this.isRow?c.defaultRowSeparatorStroke:c.defaultColumnSeparatorStroke),null!==b&&(a=this.separatorStrokeWidth,isNaN(a)&&(null!==c?a=this.isRow?c.defaultRowSeparatorStrokeWidth:c.defaultColumnSeparatorStrokeWidth:a=0)));b=this.eg;if(null===b)if(null!==c)b=
c.defaultSeparatorPadding;else return a;return a+(this.isRow?b.top:b.left)};
t.Jc=function(){var a=0,b=this.bg,c=0,d=this.isRow;if(null!==b&&b.type===X.Table)for(var e=d?b.ob.length:b.ib.length,f=0;f<e;f++){var g=d?b.ob[f]:b.ib[f];if(void 0!==g){c=g.index;break}}this.index!==c&&(c=this.separatorStroke,null===c&&null!==b&&(c=d?b.defaultRowSeparatorStroke:b.defaultColumnSeparatorStroke),null!==c&&(a=this.separatorStrokeWidth,isNaN(a)&&(null!==b?a=d?b.defaultRowSeparatorStrokeWidth:b.defaultColumnSeparatorStrokeWidth:a=0)));d=this.eg;if(null===d)if(null!==b)d=b.defaultSeparatorPadding;
else return a;return a+(this.isRow?d.top+d.bottom:d.left+d.right)};t.Db=function(a,b,c){var d=this.bg;if(null!==d&&(d.Wa(ge,a,this,b,c,void 0,void 0),null!==this.fb&&(b=d.diagram,null!==b&&!b.skipsModelSourceBindings&&(d=d.Ch(),null!==d&&(b=d.data,null!==b)))))for(c=this.fb.iterator;c.next();)c.value.zq(this,b,a,d)};function vm(a){if(a.sizing===ln){var b=a.bg;return a.isRow?b.rowSizing:b.columnSizing}return a.sizing}
t.bind=function(a,b,c,d){var e=null;"string"===typeof a?e=new si(a,b,c,d):e=a;e.pd=this;a=this.panel;null!==a&&(b=a.Ch(),null!==b&&zl(b)&&C("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+e+" on "+a));null===this.fb&&(this.fb=new F);this.fb.add(e);return this};
na.Object.defineProperties(Ij.prototype,{panel:{get:function(){return this.bg}},isRow:{get:function(){return this.nr},set:function(a){this.nr=a}},index:{get:function(){return this.Ra},set:function(a){this.Ra=a}},height:{get:function(){return this.vc},set:function(a){var b=this.vc;b!==a&&(0>a&&xa(a,">= 0",Ij,"height"),this.vc=a,this.actual=this.la,null!==this.panel&&this.panel.s(),
this.Db("height",b,a))}},width:{get:function(){return this.vc},set:function(a){var b=this.vc;b!==a&&(0>a&&xa(a,">= 0",Ij,"width"),this.vc=a,this.actual=this.la,null!==this.panel&&this.panel.s(),this.Db("width",b,a))}},minimum:{get:function(){return this.wj},set:function(a){var b=this.wj;b!==a&&((0>a||!isFinite(a))&&xa(a,">= 0",Ij,"minimum"),this.wj=a,this.actual=this.la,null!==this.panel&&this.panel.s(),this.Db("minimum",b,a))}},maximum:{
get:function(){return this.vj},set:function(a){var b=this.vj;b!==a&&(0>a&&xa(a,">= 0",Ij,"maximum"),this.vj=a,this.actual=this.la,null!==this.panel&&this.panel.s(),this.Db("maximum",b,a))}},alignment:{get:function(){return this.yb},set:function(a){var b=this.yb;b.A(a)||(this.yb=a.I(),null!==this.panel&&this.panel.s(),this.Db("alignment",b,a))}},stretch:{get:function(){return this.Ee},set:function(a){var b=this.Ee;b!==a&&(this.Ee=
a,null!==this.panel&&this.panel.s(),this.Db("stretch",b,a))}},separatorPadding:{get:function(){return this.eg},set:function(a){"number"===typeof a&&(a=new kc(a));var b=this.eg;null!==a&&null!==b&&b.A(a)||(null!==a&&(a=a.I()),this.eg=a,null!==this.panel&&this.panel.s(),this.Db("separatorPadding",b,a))}},separatorStroke:{get:function(){return this.kp},set:function(a){var b=this.kp;b!==a&&(null!==a&&Hl(a,"RowColumnDefinition.separatorStroke"),
a instanceof gl&&a.freeze(),this.kp=a,null!==this.panel&&this.panel.s(),this.Db("separatorStroke",b,a))}},separatorStrokeWidth:{get:function(){return this.lp},set:function(a){var b=this.lp;b!==a&&(this.lp=a,null!==this.panel&&this.panel.s(),this.Db("separatorStrokeWidth",b,a))}},separatorDashArray:{get:function(){return this.Hj},set:function(a){var b=this.Hj;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===
typeof f&&0<=f&&isFinite(f)||C("separatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.Hj=a;null!==this.panel&&this.panel.N();this.Db("separatorDashArray",b,a)}}},background:{get:function(){return this.Ub},set:function(a){var b=this.Ub;b!==a&&(null!==a&&Hl(a,"RowColumnDefinition.background"),a instanceof gl&&a.freeze(),this.Ub=a,null!==this.panel&&this.panel.N(),this.Db("background",b,a))}},coversSeparators:{
get:function(){return this.gn},set:function(a){var b=this.gn;b!==a&&(this.gn=a,null!==this.panel&&this.panel.N(),this.Db("coversSeparators",b,a))}},sizing:{get:function(){return this.pp},set:function(a){var b=this.pp;b!==a&&(this.pp=a,null!==this.panel&&this.panel.s(),this.Db("sizing",b,a))}},actual:{get:function(){return this.la},set:function(a){this.la=isNaN(this.vc)?Math.max(Math.min(this.vj,a),this.wj):Math.max(Math.min(this.vj,
this.vc),this.wj)}},measured:{get:function(){return this.cc},set:function(a){this.cc=a}},total:{get:function(){return this.la+this.Jc()}},position:{get:function(){return this.ja},set:function(a){this.ja=a}}});Ij.prototype.computeEffectiveSpacing=Ij.prototype.Jc;Ij.prototype.computeEffectiveSpacingTop=Ij.prototype.Cu;var ln=new D(Ij,"Default",0),wm=new D(Ij,"None",1),Om=new D(Ij,"ProportionalExtra",2);
Ij.className="RowColumnDefinition";Ij.Default=ln;Ij.None=wm;Ij.ProportionalExtra=Om;function xf(a,b){Y.call(this);this.Dd=this.ma=null;this.wn="None";this.Dn=Ok;this.Hc=this.Tk="black";this.hg=1;this.Jl="butt";this.Kl="miter";this.Ij=10;this.mh=null;this.nh=0;this.nf=this.mf=Tc;this.Lo=this.Ko=NaN;this.Sn=!1;this.No=null;this.Uk=this.Ql="None";this.Zd=1;this.Xd=0;this.Vd=1;this.Wd=null;"string"===typeof a?this.figure=a:a&&Object.assign(this,a);b&&Object.assign(this,b)}ma(xf,Y);
xf.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.ma=this.ma;a.wn=this.wn;a.Dn=this.Dn;a.Dd=this.Dd;a.Tk=this.Tk;a.Hc=this.Hc;a.hg=this.hg;a.Jl=this.Jl;a.Kl=this.Kl;a.Ij=this.Ij;null!==this.mh&&(a.mh=Ba(this.mh));a.nh=this.nh;a.mf=this.mf.I();a.nf=this.nf.I();a.Ko=this.Ko;a.Lo=this.Lo;a.Sn=this.Sn;a.No=this.No;a.Ql=this.Ql;a.Uk=this.Uk;a.Zd=this.Zd;a.Xd=this.Xd;a.Vd=this.Vd;a.Wd=this.Wd};t=xf.prototype;
t.gb=function(a){a===og||a===qg||a===Rk||a===Ok?this.geometryStretch=a:Y.prototype.gb.call(this,a)};t.toString=function(){return"Shape("+("None"!==this.figure?this.figure:"None"!==this.toArrow?this.toArrow:this.fromArrow)+")#"+fb(this)};
function mn(a,b,c,d){var e=c.length;if(!(4>e)){var f=d.measuredBounds,g=Math.max(1,f.width);f=f.height;for(var h=c[0],k=c[1],l,m,n,p,r,q,u=0,w=Ga(),v=2;v<e;v+=2)l=c[v],m=c[v+1],n=l-h,h=m-k,0===n&&(n=.001),p=h/n,r=Math.atan2(h,n),q=Math.sqrt(n*n+h*h),w.push([n,r,p,q]),u+=q,h=l,k=m;h=c[0];k=c[1];n=d.measuredBounds.width;d instanceof xf&&(n-=d.strokeWidth);1>n&&(n=1);e=c=n;l=g/2;m=0===l?!1:!0;v=0;q=w[v];n=q[0];r=q[1];p=q[2];q=q[3];for(var A=0;.1<=u;){0===A&&(m?(e=c,e-=l,u-=l,m=!1):e=c,0===e&&(e=1));
if(e>u){Ja(w);return}e>q?(A=e-q,e=q):A=0;var y=Math.sqrt(e*e/(1+p*p));0>n&&(y=-y);h+=y;k+=p*y;a.translate(h,k);a.rotate(r);a.translate(-(g/2),-(f/2));0===A&&d.Ei(a,b);a.translate(g/2,f/2);a.rotate(-r);a.translate(-h,-k);u-=e;q-=e;if(0!==A){v++;if(v===w.length){Ja(w);return}q=w[v];n=q[0];r=q[1];p=q[2];q=q[3];e=A}}Ja(w)}}
t.Ei=function(a,b){var c=this.Hc,d=this.Tk;if(null!==c||null!==d){var e=this.ma;if(null!==e){a.Ed();var f=this.actualBounds,g=this.naturalBounds;null!==d&&ci(this,a,d,!0,!1,g,f);var h=this.part,k=this.hg;null===c||0!==k||null===h||!this.isPanelMain&&h.pb()!==this||(k=h.type===X.Link&&h instanceof ye&&"Selection"===h.category&&h.adornedObject instanceof xf&&h.adornedPart.pb()===h.adornedObject?h.adornedObject.strokeWidth:0);0===k&&(c=null);null!==c&&0!==k&&(ci(this,a,c,!1,!1,g,f),a.lineWidth=k,a.lineJoin=
this.Kl,a.lineCap=this.Jl,a.miterLimit=this.Ij);f=!1;h&&b.Ie("drawShadows")&&(f=h.isShadowed);h=!0;null===c||null!==d&&"transparent"!==d||(h=!1);g=!1;k=this.strokeDashArray;null!==k&&(g=!0,a.ns(k,this.nh));if(e.type===P.j)a.beginPath(),a.moveTo(e.startX,e.startY),a.lineTo(e.endX,e.endY),null!==c&&a.Wi();else if(e.type===P.D){var l=e.startX;k=e.startY;var m=e.endX,n=e.endY;e=Math.min(l,m);var p=Math.min(k,n);l=Math.abs(m-l);k=Math.abs(n-k);a.beginPath();a.rect(e,p,l,k);null!==d&&a.yf(d);if(null!==
c){h&&f&&kl(a);if(0===l||0===k)a.beginPath(),a.rect(e,p,Math.max(l,.1),Math.max(k,.1));a.Wi();h&&f&&jl(a)}}else if(e.type===P.L)l=e.startX,k=e.startY,m=e.endX,n=e.endY,e=Math.abs(m-l)/2,p=Math.abs(n-k)/2,l=Math.min(l,m)+e,k=Math.min(k,n)+p,a.beginPath(),a.moveTo(l,k-p),a.bezierCurveTo(l+L.vg*e,k-p,l+e,k-L.vg*p,l+e,k),a.bezierCurveTo(l+e,k+L.vg*p,l+L.vg*e,k+p,l,k+p),a.bezierCurveTo(l-L.vg*e,k+p,l-e,k+L.vg*p,l-e,k),a.bezierCurveTo(l-e,k-L.vg*p,l-L.vg*e,k-p,l,k-p),a.closePath(),null!==d&&a.yf(d),null!==
c&&(h&&f?(kl(a),a.Wi(),jl(a)):a.Wi());else if(e.type===P.o)for(e=e.figures,k=e.length,p=0;p<k;p++){l=e.m[p];a.beginPath();a.moveTo(l.startX,l.startY);m=l.segments.m;n=m.length;for(var r=null,q=0;q<n;q++){var u=m[q];switch(u.type){case Pd:a.moveTo(u.endX,u.endY);break;case rd:a.lineTo(u.endX,u.endY);break;case Qd:a.bezierCurveTo(u.point1X,u.point1Y,u.point2X,u.point2Y,u.endX,u.endY);break;case Rd:a.quadraticCurveTo(u.point1X,u.point1Y,u.endX,u.endY);break;case Sd:if(u.radiusX===u.radiusY){var w=Math.PI/
180;a.arc(u.point1X,u.point1Y,u.radiusX,u.startAngle*w,(u.startAngle+u.sweepAngle)*w,0>u.sweepAngle,null!==r?r.endX:l.startX,null!==r?r.endY:l.startY)}else if(r=Ud(u,l),w=r.length,0===w)a.lineTo(u.centerX,u.centerY);else for(var v=0;v<w;v++){var A=r[v];0===v&&a.lineTo(A[0],A[1]);a.bezierCurveTo(A[2],A[3],A[4],A[5],A[6],A[7])}break;case Td:v=w=0;if(null!==r&&r.type===Sd){r=Ud(r,l);A=r.length;if(0===A){a.lineTo(u.endX,u.endY);break}r=r[A-1]||null;null!==r&&(w=r[6],v=r[7])}else w=null!==r?r.endX:l.startX,
v=null!==r?r.endY:l.startY;r=Vd(u,l,w,v);w=r.length;if(0===w){a.lineTo(u.endX,u.endY);break}for(v=0;v<w;v++)A=r[v],a.bezierCurveTo(A[2],A[3],A[4],A[5],A[6],A[7]);break;default:C("Segment not of valid type: "+u.type)}u.isClosed&&a.closePath();r=u}m=l.isFilled;f?l.isShadowed?(!0===m&&"transparent"!==d&&null!==d&&a.yf(d),null!==c&&(m&&h&&kl(a),a.Wi(),m&&h&&jl(a))):(kl(a),m&&"transparent"!==d&&null!==d&&a.yf(d),null!==c&&a.Wi(),jl(a)):(m&&null!==d&&a.yf(d),null!==c&&a.Wi())}g&&a.ls();if(null!==this.pathPattern){c=
this.pathPattern;c.measure(Infinity,Infinity);d=c.measuredBounds;c.arrange(0,0,d.width,d.height);f=this.geometry;a.save();a.beginPath();d=Ga();if(f.type===P.j)d.push(f.startX),d.push(f.startY),d.push(f.endX),d.push(f.endY),mn(a,b,d,c);else if(f.type===P.o)for(f=f.figures.iterator;f.next();){h=f.value;d.length=0;d.push(h.startX);d.push(h.startY);g=h.startX;e=h.startY;k=g;p=e;l=h.segments.m;m=l.length;for(n=0;n<m;n++){q=l[n];switch(q.type){case Pd:mn(a,b,d,c);d.length=0;d.push(q.endX);d.push(q.endY);
g=q.endX;e=q.endY;k=g;p=e;break;case rd:d.push(q.endX);d.push(q.endY);g=q.endX;e=q.endY;break;case Qd:L.Fe(g,e,q.point1X,q.point1Y,q.point2X,q.point2Y,q.endX,q.endY,.5,d);g=q.endX;e=q.endY;break;case Rd:L.kq(g,e,q.point1X,q.point1Y,q.endX,q.endY,.5,d);g=q.endX;e=q.endY;break;case Sd:u=Ud(q,h);r=u.length;if(0===r){d.push(q.centerX);d.push(q.centerY);g=q.centerX;e=q.centerY;break}for(w=0;w<r;w++)v=u[w],L.Fe(g,e,v[2],v[3],v[4],v[5],v[6],v[7],.5,d),g=v[6],e=v[7];break;case Td:u=Vd(q,h,g,e);r=u.length;
if(0===r){d.push(q.endX);d.push(q.endY);g=q.endX;e=q.endY;break}for(w=0;w<r;w++)v=u[w],L.Fe(g,e,v[2],v[3],v[4],v[5],v[6],v[7],.5,d),g=v[6],e=v[7];break;default:C("Segment not of valid type: "+q.type)}q.isClosed&&(d.push(k),d.push(p),mn(a,b,d,c))}mn(a,b,d,c)}else if(f.type===P.D)d.push(f.startX),d.push(f.startY),d.push(f.endX),d.push(f.startY),d.push(f.endX),d.push(f.endY),d.push(f.startX),d.push(f.endY),d.push(f.startX),d.push(f.startY),mn(a,b,d,c);else if(f.type===P.L){e=new $d;e.startX=f.endX;e.startY=
(f.startY+f.endY)/2;g=new ae(Sd);g.startAngle=0;g.sweepAngle=360;g.centerX=(f.startX+f.endX)/2;g.centerY=(f.startY+f.endY)/2;g.radiusX=Math.abs(f.startX-f.endX)/2;g.radiusY=Math.abs(f.startY-f.endY)/2;e.add(g);f=Ud(g,e);h=f.length;if(0===h)d.push(g.centerX),d.push(g.centerY);else for(g=e.startX,e=e.startY,k=0;k<h;k++)p=f[k],L.Fe(g,e,p[2],p[3],p[4],p[5],p[6],p[7],.5,d),g=p[6],e=p[7];mn(a,b,d,c)}Ja(d);a.restore();a.Ic(!1)}}}};
t.da=function(a,b){void 0===b&&(b=new J);if(a instanceof N){a.Ac()&&C("getDocumentPoint Spot must be a real, specific Spot, not: "+a.toString());var c=this.naturalBounds,d=this.strokeWidth;b.h(a.x*(c.width+d)-d/2+c.x+a.offsetX,a.y*(c.height+d)-d/2+c.y+a.offsetY)}else b.set(a);this.fe.Aa(b);return b};
t.Li=function(a){void 0===a&&(a=new M);var b=this.naturalBounds,c=this.fe;b=M.allocAt(b.x,b.y,b.width,b.height);var d=this.strokeWidth;b.Kc(d/2,d/2);d=J.allocAt(b.x,b.y).transform(c);a.h(d.x,d.y,0,0);d.h(b.right,b.y).transform(c);$b(a,d.x,d.y,0,0);d.h(b.right,b.bottom).transform(c);$b(a,d.x,d.y,0,0);d.h(b.x,b.bottom).transform(c);$b(a,d.x,d.y,0,0);M.free(b);J.free(d);return a};
t.Bh=function(a,b){var c=this.geometry;if(null===c||null===this.fill&&null===this.stroke)return!1;var d=c.bounds,e=this.strokeWidth/2;c.type!==P.j||b||(e+=2);var f=M.alloc();f.assign(d);f.Kc(e+2,e+2);if(!f.$(a))return M.free(f),!1;d=e+1E-4;if(c.type===P.j){if(null===this.stroke)return!1;d=(c.endX-c.startX)*(a.x-c.startX)+(c.endY-c.startY)*(a.y-c.startY);if(0>(c.startX-c.endX)*(a.x-c.endX)+(c.startY-c.endY)*(a.y-c.endY)||0>d)return!1;M.free(f);return L.Nb(c.startX,c.startY,c.endX,c.endY,e,a.x,a.y)}if(c.type===
P.D){b=c.startX;var g=c.startY,h=c.endX;c=c.endY;f.x=Math.min(b,h);f.y=Math.min(g,c);f.width=Math.abs(h-b);f.height=Math.abs(c-g);if(null===this.fill){f.Kc(-d,-d);if(f.$(a))return M.free(f),!1;f.Kc(d,d)}null!==this.stroke&&f.Kc(e,e);a=f.$(a);M.free(f);return a}if(c.type===P.L){g=c.startX;e=c.startY;h=c.endX;var k=c.endY;c=Math.min(g,h);b=Math.min(e,k);g=Math.abs(h-g)/2;e=Math.abs(k-e)/2;c=a.x-(c+g);b=a.y-(b+e);if(null===this.fill){g-=d;e-=d;if(0>=g||0>=e||1>=c*c/(g*g)+b*b/(e*e))return M.free(f),!1;
g+=d;e+=d}null!==this.stroke&&(g+=d,e+=d);M.free(f);return 0>=g||0>=e?!1:1>=c*c/(g*g)+b*b/(e*e)}if(c.type===P.o)return M.free(f),null===this.fill?Yd(c,a.x,a.y,e):Wd(c,a,e,1<this.strokeWidth,b);C("Unknown Geometry type: "+c.type)};
t.gm=function(a,b,c,d){var e=this.desiredSize,f=this.hg;a=Math.max(a,0);b=Math.max(b,0);if(null!==this.Dd)var g=this.geometry.bounds;else{var h=this.figure,k=nn[h];if(void 0===k){var l=L.Qe[h];"string"===typeof l&&(l=L.Qe[l]);"function"===typeof l?(k=l(null,100,100),nn[h]=k):C("Unsupported Figure: "+h)}g=k.bounds}h=g.width;k=g.height;l=g.width;var m=g.height;switch(bl(this,!0)){case og:d=c=0;break;case pd:l=Math.max(a-f,0);m=Math.max(b-f,0);break;case Pk:l=Math.max(a-f,0);d=0;break;case Qk:c=0,m=
Math.max(b-f,0)}isFinite(e.width)&&(l=e.width);isFinite(e.height)&&(m=e.height);e=this.maxSize;g=this.minSize;c=Math.max(c-f,g.width);d=Math.max(d-f,g.height);l=Math.min(e.width,l);m=Math.min(e.height,m);l=isFinite(l)?Math.max(c,l):Math.max(h,c);m=isFinite(m)?Math.max(d,m):Math.max(k,d);c=pg(this);switch(c){case og:break;case pd:h=l;k=m;break;case qg:c=Math.min(l/h,m/k);isFinite(c)||(c=1);h*=c;k*=c;break;default:C(c+" is not a valid geometryStretch.")}null!==this.Dd?(0===h&&(h=.001),0===k&&(k=.001),
c=null!==this.Dd?this.Dd:this.ma,e=c.bounds,d=h/e.width,e=k/e.height,isFinite(d)||(d=1),isFinite(e)||(e=1),this.ma=1===d&&1===e?c:c.copy().scale(d,e)):null!==this.ma&&L.aa(this.ma.al,a-f)&&L.aa(this.ma.$k,b-f)||(this.ma=xf.makeGeometry(this,h,k));g=this.ma.bounds;Infinity===a||Infinity===b?this.xe(g.x-f/2,g.y-f/2,0===a&&0===h?0:g.width+f,0===b&&0===k?0:g.height+f):this.xe(-(f/2),-(f/2),l+f,m+f)};
function pg(a){var b=a.geometryStretch;return null!==a.Dd?b===Ok?pd:b:b===Ok?nn[a.figure].defaultStretch:b}t.zh=function(a,b,c,d){dl(this,a,b,c,d)};t.vs=function(a,b,c){return this.Zj(a.x,a.y,b.x,b.y,c)};
t.Zj=function(a,b,c,d,e){var f=this.transform,g=1/(f.m11*f.m22-f.m12*f.m21),h=f.m22*g,k=-f.m12*g,l=-f.m21*g,m=f.m11*g,n=g*(f.m21*f.dy-f.m22*f.dx),p=g*(f.m12*f.dx-f.m11*f.dy);f=a*h+b*l+n;g=a*k+b*m+p;h=c*h+d*l+n;k=c*k+d*m+p;n=this.hg/2;l=this.ma;null===l&&(this.measure(Infinity,Infinity),l=this.ma);var r=l.bounds;m=!1;if(l.type===P.j)if(1.5>=this.strokeWidth)m=L.Le(l.startX,l.startY,l.endX,l.endY,f,g,h,k,e);else{l.startX===l.endX?(d=n,m=0):(b=(l.endY-l.startY)/(l.endX-l.startX),m=n/Math.sqrt(1+b*b),
d=m*b);b=Ga();a=new J;L.Le(l.startX+d,l.startY+m,l.endX+d,l.endY+m,f,g,h,k,a)&&b.push(a);a=new J;L.Le(l.startX-d,l.startY-m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);a=new J;L.Le(l.startX+d,l.startY+m,l.startX-d,l.startY-m,f,g,h,k,a)&&b.push(a);a=new J;L.Le(l.endX+d,l.endY+m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);h=b.length;if(0===h)return Ja(b),!1;m=!0;k=Infinity;for(d=0;d<h;d++)a=b[d],c=(a.x-f)*(a.x-f)+(a.y-g)*(a.y-g),c<k&&(k=c,e.x=a.x,e.y=a.y);Ja(b)}else if(l.type===P.D)m=L.Cf(r.x-n,r.y-n,r.x+r.width+
n,r.y+r.height+n,f,g,h,k,e);else if(l.type===P.L){b=M.allocAt(r.x,r.y,r.width,r.height).Kc(n,n);a:if(0===b.width)m=L.Le(b.x,b.y,b.x,b.y+b.height,f,g,h,k,e);else if(0===b.height)m=L.Le(b.x,b.y,b.x+b.width,b.y,f,g,h,k,e);else{a=b.width/2;l=b.height/2;d=b.x+a;m=b.y+l;c=9999;f!==h&&(c=(g-k)/(f-h));if(9999>Math.abs(c)){k=g-m-c*(f-d);if(0>a*a*c*c+l*l-k*k){e.x=NaN;e.y=NaN;m=!1;break a}n=Math.sqrt(a*a*c*c+l*l-k*k);h=(-(a*a*c*k)+a*l*n)/(l*l+a*a*c*c)+d;a=(-(a*a*c*k)-a*l*n)/(l*l+a*a*c*c)+d;l=c*(h-d)+k+m;k=c*
(a-d)+k+m;Math.abs((f-h)*(f-h))+Math.abs((g-l)*(g-l))<Math.abs((f-a)*(f-a))+Math.abs((g-k)*(g-k))?(e.x=h,e.y=l):(e.x=a,e.y=k)}else{h=l*l;k=f-d;h-=h/(a*a)*k*k;if(0>h){e.x=NaN;e.y=NaN;m=!1;break a}k=Math.sqrt(h);h=m+k;k=m-k;Math.abs(h-g)<Math.abs(k-g)?(e.x=f,e.y=h):(e.x=f,e.y=k)}m=!0}M.free(b)}else if(l.type===P.o){p=J.alloc();var q=h-f;var u=k-g,w=q*q+u*u,v=f,A=g;if(0<w&&r.contains(v,A)&&(p.x=v,p.y=A,this.$(p)))for(0!==q&&.5>Math.abs(q)?(u*=.5/q,q=.5):0!==u&&.5>Math.abs(u)&&(q*=.5/u,u=.5),v-=q,A-=
u;r.contains(v,A);)v-=q,A-=u;e.x=h;e.y=k;for(u=0;u<l.figures.count;u++){var y=l.figures.m[u],B=y.isFilled?v:f,z=y.isFilled?A:g,E=y.segments;r=y.startX;q=y.startY;for(var K=r,O=q,S=0;S<E.count;S++){var Q=E.m[S],H=Q.type;var da=Q.endX;var ba=Q.endY;var pa=!1;switch(H){case Pd:K=da;O=ba;break;case rd:pa=on(r,q,da,ba,B,z,h,k,p);break;case Qd:pa=L.Np(r,q,Q.point1X,Q.point1Y,Q.point2X,Q.point2Y,da,ba,B,z,h,k,.6,p);break;case Rd:pa=L.Np(r,q,r+2/3*(Q.point1X-r),q+2/3*(Q.point1Y-q),da+2/3*(Q.point1X-da),ba+
2/3*(Q.point1Y-ba),da,ba,B,z,h,k,.6,p);break;case Sd:case Td:H=Q.type===Sd?Ud(Q,y):Vd(Q,y,r,q);var Ca=H.length;if(0===Ca){pa=on(r,q,Q.type===Sd?Q.centerX:Q.endX,Q.type===Sd?Q.centerY:Q.endY,B,z,h,k,p);break}ba=null;for(da=0;da<Ca;da++){ba=H[da];if(0===da&&on(r,q,ba[0],ba[1],B,z,h,k,p)){var cb=yn(B,z,p,w,e);cb<w&&(w=cb,m=!0)}L.Np(ba[0],ba[1],ba[2],ba[3],ba[4],ba[5],ba[6],ba[7],B,z,h,k,.6,p)&&(cb=yn(B,z,p,w,e),cb<w&&(w=cb,m=!0))}da=ba[6];ba=ba[7];break;default:C("Unknown Segment type: "+H)}r=da;q=ba;
pa&&(pa=yn(B,z,p,w,e),pa<w&&(w=pa,m=!0));Q.isClosed&&(da=K,ba=O,on(r,q,da,ba,B,z,h,k,p)&&(Q=yn(B,z,p,w,e),Q<w&&(w=Q,m=!0)))}}f=c-a;g=d-b;h=Math.sqrt(f*f+g*g);0!==h&&(f/=h,g/=h);e.x-=f*n;e.y-=g*n;J.free(p)}else C("Unknown Geometry type: "+l.type);if(!m)return!1;this.transform.Aa(e);return!0};function yn(a,b,c,d,e){a=c.x-a;b=c.y-b;b=a*a+b*b;return b<d?(e.x=c.x,e.y=c.y,b):d}
function on(a,b,c,d,e,f,g,h,k){var l=!1,m=(e-g)*(b-d)-(f-h)*(a-c);if(0===m)return!1;k.x=((e*h-f*g)*(a-c)-(e-g)*(a*d-b*c))/m;k.y=((e*h-f*g)*(b-d)-(f-h)*(a*d-b*c))/m;(a>c?a-c:c-a)<(b>d?b-d:d-b)?(a=b<d?b:d,b=b<d?d:b,(k.y>a||L.aa(k.y,a))&&(k.y<b||L.aa(k.y,b))&&(l=!0)):(b=a<c?a:c,a=a<c?c:a,(k.x>b||L.aa(k.x,b))&&(k.x<a||L.aa(k.x,a))&&(l=!0));return l}
t.Ah=function(a,b){if(void 0===b)return a.Ge(this.actualBounds);var c=this.ma;null===c&&(this.measure(Infinity,Infinity),c=this.ma);c=c.bounds;var d=this.strokeWidth/2,e=!1,f=J.alloc();f.h(c.x-d,c.y-d);a.$(b.Aa(f))&&(f.h(c.x-d,c.bottom+d),a.$(b.Aa(f))&&(f.h(c.right+d,c.bottom+d),a.$(b.Aa(f))&&(f.h(c.right+d,c.y-d),a.$(b.Aa(f))&&(e=!0))));J.free(f);return e};
t.Mc=function(a,b){if(this.Ah(a,b)||void 0===b&&(b=this.transform,a.Ge(this.actualBounds)))return!0;var c=nd.alloc();c.set(b);c.As();var d=a.left,e=a.right,f=a.top;a=a.bottom;var g=J.alloc();g.h(d,f);c.Aa(g);if(this.Bh(g,!0))return J.free(g),!0;g.h(e,f);c.Aa(g);if(this.Bh(g,!0))return J.free(g),!0;g.h(d,a);c.Aa(g);if(this.Bh(g,!0))return J.free(g),!0;g.h(e,a);c.Aa(g);if(this.Bh(g,!0))return J.free(g),!0;var h=J.alloc(),k=J.alloc();c.set(b);c.lv(this.transform);c.As();h.x=e;h.y=f;h.transform(c);g.x=
d;g.y=f;g.transform(c);b=!1;zn(this,g,h,k)?b=!0:(g.x=e,g.y=a,g.transform(c),zn(this,g,h,k)?b=!0:(h.x=d,h.y=a,h.transform(c),zn(this,g,h,k)?b=!0:(g.x=d,g.y=f,g.transform(c),zn(this,g,h,k)&&(b=!0))));J.free(g);nd.free(c);J.free(h);J.free(k);return b};function zn(a,b,c,d){if(!a.vs(b,c,d))return!1;a=b.x;b=b.y;var e=c.x,f=c.y;c=d.x;d=d.y;if(a===e)return b<f?(a=b,b=f):a=f,d>=a&&d<=b;a<e?(d=a,a=e):d=e;return c>=d&&c<=a}
t.Ox=function(a,b,c){function d(a,b){for(var c=a.length,d=0;d<c;d+=2)if(b.qd(a[d],a[d+1])>e)return!0;return!1}if(c&&null!==this.fill&&this.Bh(a,!0))return!0;var e=a.xf(b),f=e;1.5<this.strokeWidth&&(e=this.strokeWidth/2+Math.sqrt(e),e*=e);b=this.ma;if(null===b&&(this.measure(Infinity,Infinity),b=this.ma,null===b))return!1;if(!c){var g=b.bounds,h=g.x,k=g.y,l=g.x+g.width;g=g.y+g.height;if(Ab(a.x,a.y,h,k)<=e&&Ab(a.x,a.y,l,k)<=e&&Ab(a.x,a.y,h,g)<=e&&Ab(a.x,a.y,l,g)<=e)return!0}h=b.startX;k=b.startY;l=
b.endX;g=b.endY;if(b.type===P.j){if(c=(h-l)*(a.x-l)+(k-g)*(a.y-g),zb(a.x,a.y,h,k,l,g)<=(0<=(l-h)*(a.x-h)+(g-k)*(a.y-k)&&0<=c?e:f))return!0}else{if(b.type===P.D)return b=!1,c&&(b=zb(a.x,a.y,h,k,h,g)<=e||zb(a.x,a.y,h,k,l,k)<=e||zb(a.x,a.y,l,k,l,g)<=e||zb(a.x,a.y,h,g,l,g)<=e),b;if(b.type===P.L){b=a.x-(h+l)/2;f=a.y-(k+g)/2;var m=Math.abs(l-h)/2,n=Math.abs(g-k)/2;if(0===m||0===n)return zb(a.x,a.y,h,k,l,g)<=e?!0:!1;if(c){if(a=L.xz(m,n,b,f),a*a<=e)return!0}else return Ab(b,f,-m,0)>=e||Ab(b,f,0,-n)>=e||Ab(b,
f,0,n)>=e||Ab(b,f,m,0)>=e?!1:!0}else if(b.type===P.o){l=b.bounds;f=l.x;h=l.y;k=l.x+l.width;l=l.y+l.height;if(a.x>k&&a.x<f&&a.y>l&&a.y<h&&zb(a.x,a.y,f,h,f,l)>e&&zb(a.x,a.y,f,h,k,h)>e&&zb(a.x,a.y,k,l,f,l)>e&&zb(a.x,a.y,k,l,k,h)>e)return!1;f=Math.sqrt(e);if(c){if(null===this.fill?Yd(b,a.x,a.y,f):Wd(b,a,f,!0,!1))return!0}else{c=b.figures;for(b=0;b<c.count;b++){f=c.m[b];g=f.startX;m=f.startY;if(a.qd(g,m)>e)return!1;h=f.segments.m;k=h.length;for(l=0;l<k;l++)switch(n=h[l],n.type){case Pd:case rd:g=n.endX;
m=n.endY;if(a.qd(g,m)>e)return!1;break;case Qd:var p=Ga();L.Fe(g,m,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.8,p);g=d(p,a);Ja(p);if(g)return!1;g=n.endX;m=n.endY;if(a.qd(g,m)>e)return!1;break;case Rd:p=Ga();L.kq(g,m,n.point1X,n.point1Y,n.endX,n.endY,.8,p);g=d(p,a);Ja(p);if(g)return!1;g=n.endX;m=n.endY;if(a.qd(g,m)>e)return!1;break;case Sd:case Td:p=n.type===Sd?Ud(n,f):Vd(n,f,g,m);var r=p.length;if(0===r){g=n.type===Sd?n.centerX:n.endX;m=n.type===Sd?n.centerY:n.endY;if(a.qd(g,m)>e)return!1;
break}n=null;for(var q=Ga(),u=0;u<r;u++)if(n=p[u],q.length=0,L.Fe(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.8,q),d(q,a))return Ja(q),!1;Ja(q);null!==n&&(g=n[6],m=n[7]);break;default:C("Unknown Segment type: "+n.type)}}return!0}}}return!1};t.fc=function(){this.ma=null};t.Mw=function(){return this.hg};
function An(a){var b=a.diagram;null!==b&&b.undoManager.isUndoingRedoing||(a.segmentOrientation=Lm,"None"!==a.Ql?(a.segmentIndex=-1,a.alignmentFocus=bd):"None"!==a.Uk&&(a.segmentIndex=0,a.alignmentFocus=new N(1-bd.x,bd.y)))}
xf.makeGeometry=function(a,b,c){if("None"!==a.toArrow)var d=Bn[a.toArrow];else"None"!==a.fromArrow?d=Bn[a.fromArrow]:(d=L.Qe[a.figure],"string"===typeof d&&(d=L.Qe[d]),void 0===d&&C("Unknown Shape.figure: "+a.figure),d=d(a,b,c),d.al=b,d.$k=c);if(null===d){var e=L.Qe.Rectangle;"function"===typeof e&&(d=e(a,b,c))}return d};
function Cn(a){var b=Bn[a];if(void 0===b){var c=a.toLowerCase();if("none"===c)return"None";b=Bn[c];if(void 0===b){var d=null,e;for(e in L.Gm)if(e.toLowerCase()===c){d=e;break}if(null!==d)return a=P.parse(L.Gm[d],!1),Bn[d]=a,c!==d&&(Bn[c]=d),d}}return"string"===typeof b?b:b instanceof P?a:null}
na.Object.defineProperties(xf.prototype,{geometry:{get:function(){return null!==this.ma?this.ma:this.Dd},set:function(a){var b=this.ma,c=this.Dd;if(b!==a){null!==a?this.Dd=this.ma=a.freeze():this.Dd=this.ma=null;var d=this.part;null!==d&&(d.Xf=NaN);this.s();this.g("geometry",b||c,a);Yk(this)&&(a=this.part,null!==a&&Zk(this,a,"geometryString"))}}},geometryString:{get:function(){return null===this.geometry?"":this.geometry.toString()},set:function(a){a=
P.parse(a);var b=a.normalize();this.geometry=a;this.position=a=J.allocAt(-b.x,-b.y);J.free(a)}},isGeometryPositioned:{get:function(){return this.Sn},set:function(a){var b=this.Sn;b!==a&&(this.Sn=a,this.s(),this.g("isGeometryPositioned",b,a))}},fill:{get:function(){return this.Tk},set:function(a){var b=this.Tk;b!==a&&(null!==a&&Hl(a,"Shape.fill"),a instanceof gl&&a.freeze(),this.Tk=a,this.N(),this.g("fill",b,a))}},stroke:{
get:function(){return this.Hc},set:function(a){var b=this.Hc;b!==a&&(null!==a&&Hl(a,"Shape.stroke"),a instanceof gl&&a.freeze(),this.Hc=a,this.N(),this.g("stroke",b,a))}},strokeWidth:{get:function(){return this.hg},set:function(a){var b=this.hg;if(b!==a)if(0<=a){this.hg=a;this.s();var c=this.part;null!==c&&(c.Xf=NaN);this.g("strokeWidth",b,a)}else xa(a,"value >= 0",xf,"strokeWidth:value")}},strokeCap:{get:function(){return this.Jl},
set:function(a){var b=this.Jl;b!==a&&("string"!==typeof a||"butt"!==a&&"round"!==a&&"square"!==a?xa(a,'"butt", "round", or "square"',xf,"strokeCap"):(this.Jl=a,this.N(),this.g("strokeCap",b,a)))}},strokeJoin:{get:function(){return this.Kl},set:function(a){var b=this.Kl;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?xa(a,'"miter", "bevel", or "round"',xf,"strokeJoin"):(this.Kl=a,this.N(),this.g("strokeJoin",b,a)))}},strokeMiterLimit:{
get:function(){return this.Ij},set:function(a){var b=this.Ij;if(b!==a&&1<=a){this.Ij=a;this.N();var c=this.part;null!==c&&(c.Xf=NaN);this.g("strokeMiterLimit",b,a)}}},strokeDashArray:{get:function(){return this.mh},set:function(a){var b=this.mh;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];0<=f&&isFinite(f)||C("strokeDashArray:value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.mh=
a;this.N();this.g("strokeDashArray",b,a)}}},strokeDashOffset:{get:function(){return this.nh},set:function(a){var b=this.nh;b!==a&&0<=a&&(this.nh=a,this.N(),this.g("strokeDashOffset",b,a))}},figure:{get:function(){return this.wn},set:function(a){var b=this.wn;if(b!==a){var c=L.Qe[a];"function"===typeof c?c=a:(c=L.Qe[a.toLowerCase()])||C("Unknown Shape.figure: "+a);b!==c&&(a=this.part,null!==a&&(a.Xf=NaN),this.wn=c,this.Dd=null,this.fc(),this.s(),
this.g("figure",b,c))}}},toArrow:{get:function(){return this.Ql},set:function(a){var b=this.Ql;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=Cn(a);null===c?C("Unknown Shape.toArrow: "+a):b!==c&&(this.Ql=c,this.Dd=null,this.fc(),this.s(),An(this),this.g("toArrow",b,c))}}},fromArrow:{get:function(){return this.Uk},set:function(a){var b=this.Uk;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=Cn(a);null===c?C("Unknown Shape.fromArrow: "+
a):b!==c&&(this.Uk=c,this.Dd=null,this.fc(),this.s(),An(this),this.g("fromArrow",b,c))}}},spot1:{get:function(){return this.mf},set:function(a){var b=this.mf;b.A(a)||(this.mf=a=a.I(),this.s(),this.g("spot1",b,a))}},spot2:{get:function(){return this.nf},set:function(a){var b=this.nf;b.A(a)||(this.nf=a=a.I(),this.s(),this.g("spot2",b,a))}},parameter1:{get:function(){return this.Ko},set:function(a){var b=this.Ko;
b!==a&&(this.Ko=a,this.fc(),this.s(),this.g("parameter1",b,a))}},parameter2:{get:function(){return this.Lo},set:function(a){var b=this.Lo;b!==a&&(this.Lo=a,this.fc(),this.s(),this.g("parameter2",b,a))}},naturalBounds:{get:function(){var a=this.desiredSize;return a.u()||null===this.ma?new M(0,0,a.width,a.height):(this.uc.assign(this.ma.bounds),this.uc)}},pathPattern:{get:function(){return this.No},set:function(a){var b=
this.No;b!==a&&(this.No=a,this.N(),this.g("pathPattern",b,a))}},geometryStretch:{get:function(){return this.Dn},set:function(a){var b=this.Dn;b!==a&&(this.Dn=a,this.s(),this.g("geometryStretch",b,a))}},interval:{get:function(){return this.Zd},set:function(a){var b=this.Zd;a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Zd=a;var c=this.diagram;null!==c&&this.panel===c.grid&&dj(c);this.s();c=this.panel;null!==c&&(c.Rf=null);this.g("interval",
b,a)}}},graduatedStart:{get:function(){return this.Xd},set:function(a){var b=this.Xd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Xd=a,this.s(),this.g("graduatedStart",b,a))}},graduatedEnd:{get:function(){return this.Vd},set:function(a){var b=this.Vd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Vd=a,this.s(),this.g("graduatedEnd",b,a))}},graduatedSkip:{get:function(){return this.Wd},set:function(a){var b=this.Wd;b!==a&&(this.Wd=a,this.s(),
this.g("graduatedSkip",b,a))}}});xf.prototype.intersectsRect=xf.prototype.Mc;xf.prototype.containedInRect=xf.prototype.Ah;xf.prototype.getNearestIntersectionPoint=xf.prototype.vs;xf.prototype.getDocumentBounds=xf.prototype.Li;xf.prototype.getDocumentPoint=xf.prototype.da;var Bn=new Xa,nn=new Xa;xf.className="Shape";xf.getFigureGenerators=function(){var a=new I,b;for(b in L.Qe)b!==b.toLowerCase()&&a.add(b,L.Qe[b]);a.freeze();return a};
xf.defineFigureGenerator=function(a,b){var c=a.toLowerCase(),d=L.Qe;d[a]=b;d[c]=a};xf.getArrowheadGeometries=function(){var a=new I;for(d in L.Gm)if(void 0===Bn[d]){var b=P.parse(L.Gm[d],!1);Bn[d]=b;b=d.toLowerCase();b!==d&&(Bn[b]=d)}for(var c in Bn)if(c!==c.toLowerCase()){var d=Bn[c];d instanceof P&&a.add(c,d)}a.freeze();return a};
xf.defineArrowheadGeometry=function(a,b){var c=null;"string"===typeof b?c=P.parse(b,!1):c=b;b=a.toLowerCase();"none"!==b&&a!==b||C("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+a);var d=Bn;d[a]=c;d[b]=a};
function Lg(a,b){Y.call(this);Dn||(En=Jg?(new uk(null)).context:null,Dn=!0);this.Xb="";this.Hc="black";this.qe="13px sans-serif";this.ti="start";this.Ud=og;this.Ai=Yc;this.oj=!0;this.ai=this.bi=!1;this.$f=Fn;this.lg=Gn;this.vr=this.sb=this.Yc=0;this.Pt=this.Qt=null;this.tn=!1;this.nd=this.Wm=this.yp=this.ui=this.zp=null;this.lf=this.kf=0;this.Yh=Hn;this.we=Infinity;this.ei=0;this.re=null;this.Ce=0;this.pe=this.Sb=this.Dc=null;this.Zd=1;this.Xd=0;this.Vd=1;this.Wd=this.hj=null;"string"===typeof a?
this.text=a:a&&Object.assign(this,a);b&&Object.assign(this,b);return this}ma(Lg,Y);
Lg.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.Xb=this.Xb;a.Hc=this.Hc;a.qe=this.qe;a.ti=this.ti;a.Ud=this.Ud;a.Ai=this.Ai;a.oj=this.oj;a.bi=this.bi;a.ai=this.ai;a.$f=this.$f;a.lg=this.lg;a.Yc=this.Yc;a.vr=this.vr;a.sb=this.sb;a.Qt=this.Qt;a.Pt=this.Pt;a.tn=this.tn;a.zp=this.zp;a.ui=this.ui;a.yp=this.yp;a.Wm=this.Wm;a.nd=this.nd;a.kf=this.kf;a.lf=this.lf;a.Yh=this.Yh;a.we=this.we;a.re=this.re;a.Ce=this.Ce;a.Dc=this.Dc;a.Sb=this.Sb;a.pe=this.pe;a.ei=this.ei;a.Zd=
this.Zd;a.Xd=this.Xd;a.Vd=this.Vd;a.hj=this.hj;a.Wd=this.Wd};
function Km(a,b){a.G=b.G|6144;a.mb=b.opacity;a.Ub=b.background;a.jd=b.areaBackground;a.Uc=b.desiredSize.I();a.Zf=b.minSize.I();a.Yf=b.maxSize.I();null!==b.Bb?a.Bb=b.Bb.copy():a.Bb=null;a.sa=b.scale;a.zb=b.angle;a.Ee=b.stretch;a.Ug=b.margin.I();a.yb=b.alignment.I();a.wk=b.alignmentFocus.I();a.zl=b.segmentFraction;a.Al=b.segmentOffset.I();a.Bl=b.segmentOrientation;null!==b.$a&&(a.$a=b.$a.copy());a.Dl=b.shadowVisible;b instanceof Lg&&(a.Xb=b.Xb,a.Hc=b.Hc,a.qe=b.qe,a.ti=b.ti,a.Ud=b.Ud,a.Ai=b.Ai,a.oj=
b.oj,a.bi=b.bi,a.ai=b.ai,a.$f=b.$f,a.lg=b.lg,a.re=null,a.kf=b.kf,a.lf=b.lf,a.we=b.we,a.ei=b.ei,a.Zd=b.Zd,a.Xd=b.Xd,a.Vd=b.Vd,a.hj=b.hj,a.Wd=b.Wd)}t=Lg.prototype;t.gb=function(a){a.classType===Lg?this.wrap=a:Y.prototype.gb.call(this,a)};t.toString=function(){return 22<this.Xb.length?'TextBlock("'+this.Xb.substring(0,20)+'"...)':'TextBlock("'+this.Xb+'")'};t.s=function(){Y.prototype.s.call(this);this.Pt=this.Qt=null};
t.Ei=function(a,b){if(null!==this.Hc&&0!==this.Xb.length&&null!==this.qe){var c=this.naturalBounds,d=this.actualBounds,e=c.width,f=c.height,g=In(this),h=a.textAlign=this.ti,k=b.Vn;"start"===h?h=k?"right":"left":"end"===h&&(h=k?"left":"right");k=this.bi;var l=this.ai;ci(this,a,this.Hc,!0,!1,c,d);(k||l)&&ci(this,a,this.Hc,!1,!1,c,d);d=0;c=!1;var m=this.fe,n=m.dx-(g*m.m21+m.dx);m=m.dy-(g*m.m22+m.dy);var p=b.scale;8>(n*n+m*m)*p*p&&(c=!0);b.Vb!==a&&(c=!1);!1===b.Ie("textGreeking")&&(c=!1);b=this.kf;n=
this.lf;switch(this.flip){case Tk:a.translate(e,0);a.scale(-1,1);break;case Sk:a.translate(0,f);a.scale(1,-1);break;case Uk:a.translate(e,f),a.scale(-1,-1)}a.Ed();m=this.Yc;p=(b+g+n)*m;f>p&&(d=this.Ai,d=d.y*f-d.y*p+d.offsetY);if(1===m&&null!==this.pe)n=this.sb,n>e&&(n=e),this.Di(this.pe,a,0,d+b,e,g,n,c,h,k,l);else if(null!==this.Dc&&null!==this.Sb)for(p=0;p<m;p++){var r=this.Dc[p];r>e&&(r=e);d+=b;this.Di(this.Sb[p],a,0,d,e,g,r,c,h,k,l);d+=g+n}switch(this.flip){case Tk:a.scale(-1,1);a.translate(-e,
0);break;case Sk:a.scale(1,-1);a.translate(0,-f);break;case Uk:a.scale(-1,-1),a.translate(-e,-f)}}};
t.Di=function(a,b,c,d,e,f,g,h,k,l,m){var n=0;h?("left"===k?n=0:"right"===k?n=e-g:"center"===k&&(n=(e-g)/2),b.fillRect(c+n,d+.25*f,g,1)):("left"===k?n=0:"right"===k?n=e:"center"===k&&(n=e/2),e=null!==Jn?Jn(this,f):.75*f,b.fillText(a,c+n,d+e),a=f/20|0,0===a&&(a=1),"right"===k?n-=g:"center"===k&&(n-=g/2),l&&(k=null!==Kn?Kn(this,f):.8*f,b.beginPath(),b.lineWidth=a,b.moveTo(c+n,d+k),b.lineTo(c+n+g,d+k),b.stroke()),m&&(b.beginPath(),b.lineWidth=a,d=d+f-f/2.2|0,0!==a%2&&(d+=.5),b.moveTo(c+n,d),b.lineTo(c+
n+g,d),b.stroke()))};
t.gm=function(a,b,c,d){this.ei=a;var e=this.qe;null!==En&&Ln!==e&&(Ln=En.font=e);this.sb=this.Ce=0;this.pe=this.Sb=this.Dc=this.re=null;var f;if(isNaN(this.desiredSize.width)){e=this.Xb.replace(/\r\n/g,"\n").replace(/\r/g,"\n");if(0===e.length)e=0;else if(this.isMultiline){for(var g=f=0,h=!1;!h;){var k=e.indexOf("\n",g);-1===k&&(k=e.length,h=!0);g=e.substr(g,k-g);this.Yh===Hn&&(g=g.trim());f=Math.max(f,Mn(g));g=k+1}e=f}else f=e.indexOf("\n",0),0<=f&&(e=e.substr(0,f)),e=Mn(e);e=Math.min(e,a/this.scale);
e=Math.max(8,e)}else e=this.desiredSize.width;null!==this.panel&&(e=Math.min(e,this.panel.maxSize.width));f=Nn(this,e);isNaN(this.desiredSize.height)?f=Math.min(f,b/this.scale):f=this.desiredSize.height;h=f;if(0!==this.sb&&null!==this.Dc&&null!==this.Sb&&this.$f===On&&(b=this.qe,b=this.$f===On?Pn(b):0,k=this.kf+this.lf,k=Math.max(0,In(this)+k),h=Math.min(this.maxLines-1,Math.max(Math.floor(h/k+.01)-1,0)),!(h+1>=this.Sb.length))){k=this.Sb[h];for(b=Math.max(1,a-b);Mn(k)>b&&1<k.length;)k=k.substr(0,
k.length-1);k+=Qn;b=Mn(k);this.Sb[h]=k;this.Sb=this.Sb.slice(0,h+1);this.Dc[h]=b;this.Dc=this.Dc.slice(0,h+1);this.Ce=this.Sb.length;this.sb=Math.max(this.sb,b);this.Yc=this.Ce;1===this.Yc&&(this.pe=this.Sb[0])}if(this.wrap===Rn||isNaN(this.desiredSize.width))e=isNaN(a)?this.sb:Math.min(a,this.sb),isNaN(this.desiredSize.width)&&(e=Math.max(8,e));e=Math.max(c,e);f=Math.max(d,f);Qb(this.uc,e,f);this.xe(0,0,e,f)};t.zh=function(a,b,c,d){dl(this,a,b,c,d)};
function Sn(a,b,c){if(null===a.pe)a.pe=b,a.sb=c;else{if(null===a.Sb||null===a.Dc)a.Sb=[],a.Dc=[],a.Sb.push(a.pe),a.Dc.push(a.sb);a.Sb.push(b);a.Dc.push(c)}}
function Tn(a,b,c,d){var e=a.Yh===Hn;e&&(b=b.trim());var f=0,g=a.qe,h=a.kf+a.lf;h=Math.max(0,In(a)+h);var k=a.$f===On?Pn(g):0;if(a.Yc>=a.we)null!==d&&d.h(0,h);else if(g=b,a.lg===Un){a.Ce=1;var l=Mn(b);if(0===k||l<=c)a.sb=Math.max(a.sb,l),Sn(a,b,a.sb),null!==d&&d.h(l,h);else{f=Vn(a,g);g=g.substr(f.length);b=Vn(a,g);for(l=Mn(f+b);0<b.length&&l<=c;)f+=b,g=g.substr(b.length),b=Vn(a,g),l=f+b,e&&(l=l.trim()),l=Mn(l);e&&(b=b.trim());f+=b;for(c=Math.max(1,c-k);Mn(f)>c&&1<f.length;)f=f.substr(0,f.length-1);
f+=Qn;var m=Mn(f);a.sb=m;Sn(a,f,m);null!==d&&d.h(m,h)}}else{k=0;0===g.length&&(k=1,Sn(a,g,0));for(;0<g.length;){b=Vn(a,g);for(g=g.substr(b.length);Mn(b)>c;){var n=1;l=Mn(b.substr(0,n));for(m=0;l<=c;)n++,m=l,l=Mn(b.substr(0,n));if(1===n){var p=l;f=Math.max(f,l)}else p=m,f=Math.max(f,m);n--;1>n&&(n=1);Sn(a,b.substr(0,n),p);k++;b=b.substr(n);if(a.Yc+k>a.we)break}m=Vn(a,g);for(l=Mn(b+m);0<m.length&&l<=c;)b+=m,g=g.substr(m.length),m=Vn(a,g),l=b+m,e&&(l=l.trim()),l=Mn(l);e&&(b=b.trim());if(""!==b&&("\u00ad"===
b[b.length-1]&&(b=b.substring(0,b.length-1)+"\u2010"),0===m.length?(n=l,f=Math.max(f,l)):(n=m=Mn(b),f=Math.max(f,m)),Sn(a,b,n),k++,a.Yc+k>a.we))break}a.Ce=Math.min(a.we,k);a.sb=Math.max(a.sb,f);null!==d&&d.h(a.sb,h*a.Ce)}}function Vn(a,b){if(a.lg===Wn)return b.substr(0,1);for(var c=b.length,d=0,e=Xn;d<c&&!e.test(b.charAt(d));)d++;for(a.Yh===Yn&&(c=Math.min(c,d+1));d<c&&e.test(b.charAt(d));)d++;return d>=b.length?b:b.substr(0,d)}function Mn(a){return null===En?8*a.length:En.measureText(a).width}
function In(a){if(null!==a.re)return a.re;var b=a.qe;if(null===En){var c=16;return a.re=c}void 0!==Zn[b]&&5E3>$n?c=Zn[b]:(c=1.3*En.measureText("M").width,Zn[b]=c,$n++);return a.re=c}function Pn(a){if(null===En)return 6;if(void 0!==ao[a]&&5E3>bo)var b=ao[a];else b=En.measureText(Qn).width,ao[a]=b,bo++;return b}
function Nn(a,b){var c=a.Xb.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),d=a.kf+a.lf;d=Math.max(0,In(a)+d);if(0===c.length)return a.sb=0,a.Yc=1,d;if(!a.isMultiline){var e=c.indexOf("\n",0);0<=e&&(c=c.substr(0,e))}e=0;for(var f=a.Yc=0,g,h=!1;!h;){g=c.indexOf("\n",f);-1===g&&(g=c.length,h=!0);if(f<=g){f=c.substr(f,g-f);if(a.lg!==Un){a.Ce=0;var k=Fb.alloc();Tn(a,f,b,k);e+=k.height;Fb.free(k);a.Yc+=a.Ce}else Tn(a,f,b,null),e+=d,a.Yc++;a.Yc===a.we&&(h=!0)}f=g+1}return a.vr=e}
na.Object.defineProperties(Lg.prototype,{font:{get:function(){return this.qe},set:function(a){var b=this.qe;b!==a&&(this.qe=a,this.re=null,this.s(),this.g("font",b,a))}},text:{get:function(){return this.Xb},set:function(a){var b=this.Xb;null!==a&&void 0!==a?a=a.toString():a="";b!==a&&(this.Xb=a,this.s(),this.g("text",b,a))}},textAlign:{get:function(){return this.ti},set:function(a){var b=this.ti;b===a||"start"!==
a&&"end"!==a&&"left"!==a&&"right"!==a&&"center"!==a||(this.ti=a,this.N(),this.g("textAlign",b,a))}},flip:{get:function(){return this.Ud},set:function(a){var b=this.Ud;b!==a&&(this.Ud=a,this.N(),this.g("flip",b,a))}},verticalAlignment:{get:function(){return this.Ai},set:function(a){var b=this.Ai;b.A(a)||(this.Ai=a=a.I(),tl(this),this.g("verticalAlignment",b,a))}},naturalBounds:{get:function(){if(!this.uc.u()){var a=
Fb.alloc();Tn(this,this.Xb,999999,a);var b=a.width;Fb.free(a);a=Nn(this,b);var c=this.desiredSize;isNaN(c.width)||(b=c.width);isNaN(c.height)||(a=c.height);Qb(this.uc,b,a)}return this.uc}},isMultiline:{get:function(){return this.oj},set:function(a){var b=this.oj;b!==a&&(this.oj=a,this.s(),this.g("isMultiline",b,a))}},isUnderline:{get:function(){return this.bi},set:function(a){var b=this.bi;b!==a&&(this.bi=a,this.N(),this.g("isUnderline",
b,a))}},isStrikethrough:{get:function(){return this.ai},set:function(a){var b=this.ai;b!==a&&(this.ai=a,this.N(),this.g("isStrikethrough",b,a))}},wrap:{get:function(){return this.lg},set:function(a){var b=this.lg;b!==a&&(this.lg=a,this.s(),this.g("wrap",b,a))}},overflow:{get:function(){return this.$f},set:function(a){var b=this.$f;b!==a&&(this.$f=a,this.s(),this.g("overflow",b,a))}},stroke:{
get:function(){return this.Hc},set:function(a){var b=this.Hc;b!==a&&(null!==a&&Hl(a,"TextBlock.stroke"),a instanceof gl&&a.freeze(),this.Hc=a,this.N(),this.g("stroke",b,a))}},lineCount:{get:function(){return this.Yc}},lineHeight:{get:function(){return In(this)}},editable:{get:function(){return this.tn},set:function(a){var b=this.tn;b!==a&&(this.tn=a,this.g("editable",b,a))}},textEditor:{
get:function(){return this.zp},set:function(a){var b=this.zp;b!==a&&(this.zp=a,this.g("textEditor",b,a))}},errorFunction:{get:function(){return this.nd},set:function(a){var b=this.nd;b!==a&&(this.nd=a,this.g("errorFunction",b,a))}},interval:{get:function(){return this.Zd},set:function(a){var b=this.Zd;a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Zd=a;this.s();var c=this.panel;null!==c&&(c.Rf=null);this.g("interval",b,a)}}},graduatedStart:{
get:function(){return this.Xd},set:function(a){var b=this.Xd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Xd=a,this.s(),this.g("graduatedStart",b,a))}},graduatedEnd:{get:function(){return this.Vd},set:function(a){var b=this.Vd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Vd=a,this.s(),this.g("graduatedEnd",b,a))}},graduatedFunction:{get:function(){return this.hj},set:function(a){var b=this.hj;b!==a&&(this.hj=a,this.s(),this.g("graduatedFunction",b,a))}},
graduatedSkip:{get:function(){return this.Wd},set:function(a){var b=this.Wd;b!==a&&(this.Wd=a,this.s(),this.g("graduatedSkip",b,a))}},textValidation:{get:function(){return this.ui},set:function(a){var b=this.ui;b!==a&&(this.ui=a,this.g("textValidation",b,a))}},textEdited:{get:function(){return this.yp},set:function(a){var b=this.yp;b!==a&&(this.yp=a,this.g("textEdited",b,a))}},spacingAbove:{
get:function(){return this.kf},set:function(a){var b=this.kf;b!==a&&(this.kf=a,this.s(),this.g("spacingAbove",b,a))}},spacingBelow:{get:function(){return this.lf},set:function(a){var b=this.lf;b!==a&&(this.lf=a,this.s(),this.g("spacingBelow",b,a))}},formatting:{get:function(){return this.Yh},set:function(a){var b=this.Yh;b!==a&&(this.Yh=a,this.s(),this.g("formatting",b,a))}},maxLines:{get:function(){return this.we},
set:function(a){var b=this.we;b!==a&&(a=Math.floor(a),0>=a&&xa(a,"> 0",Lg,"maxLines"),this.we=a,this.s(),this.g("maxLines",b,a))}},metrics:{get:function(){return{arrSize:null!==this.Dc?this.Dc:[this.sb],arrText:null!==this.Sb?this.Sb:[this.pe],maxLineWidth:this.sb,fontHeight:this.re}}},choices:{get:function(){return this.Wm},set:function(a){var b=this.Wm;b!==a&&(this.Wm=a,this.g("choices",b,a))}}});
var Jn=null,Kn=null,Un=new D(Lg,"None",0),Rn=new D(Lg,"WrapFit",1),Gn=new D(Lg,"WrapDesiredSize",2),Wn=new D(Lg,"WrapBreakAll",3),Fn=new D(Lg,"OverflowClip",0),On=new D(Lg,"OverflowEllipsis",1),Hn=new D(Lg,"FormatTrim",0),Yn=new D(Lg,"FormatNone",0),Xn=/[ \u200b\u00ad]/,Zn=new Xa,$n=0,ao=new Xa,bo=0,Qn="...",Ln="",En=null,Dn=!1;Lg.className="TextBlock";Lg.getEllipsis=function(){return Qn};Lg.setEllipsis=function(a){Qn=a;ao=new Xa;bo=0};Lg.getBaseline=function(){return Jn};
Lg.setBaseline=function(a){Jn=a};Lg.getUnderline=function(){return Kn};Lg.setUnderline=function(a){Kn=a};Lg.isValidFont=function(a){Dn||(En=Jg?(new uk(null)).context:null,Dn=!0);if(null===En)return!0;var b=En.font;if(a===b||"10px sans-serif"===a)return!0;En.font="10px sans-serif";En.font=a;var c=En.font;if("10px sans-serif"!==c)return En.font=b,!0;En.font="19px serif";var d=En.font;En.font=a;c=En.font;En.font=b;return c!==d};Lg.None=Un;Lg.WrapFit=Rn;Lg.WrapDesiredSize=Gn;Lg.WrapBreakAll=Wn;
Lg.OverflowClip=Fn;Lg.OverflowEllipsis=On;function Qj(a,b){Y.call(this);this.Lg=null;this.rp="";this.lh=hc;this.Wk=pd;this.oh=this.nd=null;this.Vk=xc;this.Ud=og;this.Ml=null;this.Rn=!1;this.ar=!0;this.kl=!1;this.Fl=null;"string"===typeof a?this.source=a:a&&Object.assign(this,a);b&&Object.assign(this,b)}var co;ma(Qj,Y);
Qj.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.element=this.Lg;a.rp=this.rp;a.lh=this.lh.I();a.Wk=this.Wk;a.Ud=this.Ud;a.nd=this.nd;a.oh=this.oh;a.Vk=this.Vk.I();a.ar=this.ar;a.Fl=this.Fl};Qj.prototype.gb=function(a){a===og||a===qg||a===Rk?this.imageStretch=a:Y.prototype.gb.call(this,a)};Qj.prototype.toString=function(){return"Picture("+this.source+")#"+fb(this)};function Di(a){void 0===a&&(a="");""!==a?co[a]&&(delete co[a],eo--):(co=new Xa,eo=0)}
function fo(a,b){b.Py||(b.ur=function(c){b.lr=!0;b.Ln=!1;var d=b.Hg.copy();if(null!==d&&void 0!==d){for(d=d.iterator;d.next();){var e=d.value;var f=b.getAttribute("src")||"";var g=e.eh.H(f);if(null!==g)for(var h=g.length,k=0;k<h;k++)f=g[k],e.Oo.add(f),e.Fb(),b.En&&(void 0===b.bu&&(b.bu=c),null!==f.oh&&f.oh(f,c))}b.Hg.clear()}a.desiredSize.u()||(cj(a,!1),a.s())},b.Xq=function(a){b.Ln=a;var c=b.Hg.copy();if(null!==c&&void 0!==c){for(c=c.iterator;c.next();){var e=c.value,f=b.getAttribute("src")||"";
var g=e.eh.H(f);if(null!==g){e=g.length;f=Ga();for(var h=0;h<e;h++)f.push(g[h]);if(b.En)for(h=0;h<e;h++)g=f[h],null!==g.nd&&g.nd(g,a);Ja(f)}}b.Hg.clear()}},b.addEventListener("load",b.ur),b.addEventListener("error",b.Xq),b.Py=!0)}function Sj(a){a.ur&&a.removeEventListener("load",a.ur);a.Xq&&a.removeEventListener("error",a.Xq);delete a.ur;delete a.Xq}Qj.prototype.DA=function(){if(""!==this.source){Di(this.source);var a=this.source;this.source="";this.source=a}};Qj.prototype.redraw=function(){this.N()};
Qj.prototype.Ei=function(a,b){var c=this.Lg;if(null!==c){var d=c.getAttribute("src");if(!(c instanceof HTMLImageElement&&(null===d||""===d)||c.Ln instanceof Event&&a instanceof ol)){d=this.naturalBounds;var e=0,f=0,g=this.Rn,h=g?+c.width:c.naturalWidth;g=g?+c.height:c.naturalHeight;void 0===h&&c.videoWidth&&(h=c.videoWidth);void 0===g&&c.videoHeight&&(g=c.videoHeight);h=h||d.width;g=g||d.height;if(0!==h&&0!==g){var k=h,l=g;this.sourceRect.u()&&(e=this.lh.x,f=this.lh.y,h=this.lh.width,g=this.lh.height);
var m=h,n=g,p=this.Wk,r=this.Vk;switch(p){case og:if(this.sourceRect.u())break;m>=d.width&&(e=e+r.offsetX+(m*r.x-d.width*r.x));n>=d.height&&(f=f+r.offsetY+(n*r.y-d.height*r.y));h=Math.min(d.width,m);g=Math.min(d.height,n);break;case pd:m=d.width;n=d.height;break;case qg:case Rk:p===qg?(p=Math.min(d.height/n,d.width/m),m*=p,n*=p):p===Rk&&(p=Math.max(d.height/n,d.width/m),m*=p,n*=p,m>=d.width&&(e=(e+r.offsetX+(m*r.x-d.width*r.x)/m)*h),n>=d.height&&(f=(f+r.offsetY+(n*r.y-d.height*r.y)/n)*g),h*=1/(m/
d.width),g*=1/(n/d.height),m=d.width,n=d.height)}p=this.Af()*b.scale;var q=m*p*n*p,u=h*g/q,w=c.__goCache;p=null;var v=go;if(c.lr&&void 0!==w&&4<q&&u>v*v)for(null===w.Ci&&(ho(w,4,k,l,c),ho(w,16,k,l,c)),k=w.Ci,l=k.length,q=0;q<l;q++)if(k[q].ratio*k[q].ratio<u)p=k[q];else break;if(!b.qn){if(null===this.Ml)if(null===this.Lg)this.Ml=!1;else{k=(new uk(null)).context;k.drawImage(this.Lg,0,0);try{k.getImageData(0,0,1,1).data[3]&&(this.Ml=!1),this.Ml=!1}catch(A){this.Ml=!0}}if(this.Ml)return}k=0;m<d.width&&
(k=r.offsetX+(d.width*r.x-m*r.x));l=0;n<d.height&&(l=r.offsetY+(d.height*r.y-n*r.y));switch(this.flip){case Tk:a.translate(Math.min(d.width,m),0);a.scale(-1,1);break;case Sk:a.translate(0,Math.min(d.height,n));a.scale(1,-1);break;case Uk:a.translate(Math.min(d.width,m),Math.min(d.height,n)),a.scale(-1,-1)}a.Ed();if(b.Ie("pictureRatioOptimization")&&!b.nj&&void 0!==w&&null!==p&&1!==p.ratio){a.save();b=p.ratio;try{a.drawImage(p.source,e/b,f/b,Math.min(p.source.width,h/b),Math.min(p.source.height,g/
b),k,l,Math.min(d.width,m),Math.min(d.height,n))}catch(A){this.ar=!1}a.restore()}else try{a.drawImage(c,e,f,h,g,k,l,Math.min(d.width,m),Math.min(d.height,n))}catch(A){this.ar=!1}switch(this.flip){case Tk:a.scale(-1,1);a.translate(-Math.min(d.width,m),0);break;case Sk:a.scale(1,-1);a.translate(0,-Math.min(d.height,n));break;case Uk:a.scale(-1,-1),a.translate(-Math.min(d.width,m),-Math.min(d.height,n))}}}}};
Qj.prototype.gm=function(a,b,c,d){var e=this.desiredSize,f=bl(this,!0),g=this.Lg,h=this.Rn;if(h||!this.kl&&g&&g.complete)this.kl=!0;null===g&&(isFinite(e.width)||(a=0),isFinite(e.height)||(b=0));isFinite(e.width)||f===pd||f===Pk?(isFinite(a)||(this.sourceRect.u()?a=this.sourceRect.width:null!==g&&(a=h?+g.width:g.naturalWidth)),c=0):null!==g&&!1!==this.kl&&(a=this.sourceRect.u()?this.sourceRect.width:h?+g.width:g.naturalWidth);isFinite(e.height)||f===pd||f===Qk?(isFinite(b)||(this.sourceRect.u()?b=
this.sourceRect.height:null!==g&&(b=h?+g.height:g.naturalHeight)),d=0):null!==g&&!1!==this.kl&&(b=this.sourceRect.u()?this.sourceRect.height:h?+g.height:g.naturalHeight);isFinite(e.width)&&(a=e.width);isFinite(e.height)&&(b=e.height);e=this.maxSize;f=this.minSize;c=Math.max(c||0,f.width);d=Math.max(d||0,f.height);a=Math.min(e.width,a);b=Math.min(e.height,b);a=Math.max(c,a);b=Math.max(d,b);null===g||g.complete||(isFinite(a)||(a=0),isFinite(b)||(b=0));Qb(this.uc,a,b);this.xe(0,0,a,b)};
Qj.prototype.zh=function(a,b,c,d){dl(this,a,b,c,d)};
na.Object.defineProperties(Qj.prototype,{element:{get:function(){return this.Lg},set:function(a){var b=this.Lg;if(b!==a){this.Rn=a instanceof HTMLCanvasElement;var c=a instanceof HTMLImageElement;b instanceof HTMLImageElement&&Sj(b);null===a||c||a instanceof HTMLVideoElement||this.Rn||C("Picture.element must be an instance of Image, Canvas, or Video, not: "+a);var d=this.diagram;null!==d&&Rj(d,this);this.Lg=a;null!==a&&c&&void 0===a.Hg&&(a.Hg=new G);null!==d&&c&&Pj(d,
this);null!==a&&(this.Rn||!0===a.complete?(a.En&&(a.Ln instanceof Event&&null!==this.nd?this.nd(this,a.Ln):!0===a.lr&&!a.Ln&&null!==this.oh&&a.bu&&this.oh(this,a.bu)),a.lr=!0,this.desiredSize.u()||(cj(this,!1),this.s())):c&&fo(this,a));this.g("element",b,a);this.N()}}},source:{get:function(){return this.rp},set:function(a){var b=this.rp;if(b!==a){this.rp=a;var c=co;if(Jg){if(void 0!==c[a])var d=c[a];else if(""!==a){30<eo&&(Di(),c=co);d=va("img");d.En=!0;fo(this,d);var e=
this.Fl;null!==e&&(d.crossOrigin=e(this));d.src=a;c[a]=d;eo++}this.element=d;null!==d&&void 0===d.__goCache&&(d.__goCache=new io);this.s();this.N()}this.g("source",b,a)}}},sourceCrossOrigin:{get:function(){return this.Fl},set:function(a){if(this.Fl!==a&&(this.Fl=a,null!==this.element)){var b=this.element.getAttribute("src");null===a&&"string"===typeof b?this.element.crossOrigin=null:null!==a&&(this.element.crossOrigin=a(this));this.element.src=b}}},sourceRect:{
get:function(){return this.lh},set:function(a){var b=this.lh;b.A(a)||(this.lh=a=a.I(),this.N(),this.g("sourceRect",b,a))}},imageStretch:{get:function(){return this.Wk},set:function(a){var b=this.Wk;b!==a&&(this.Wk=a,this.N(),this.g("imageStretch",b,a))}},flip:{get:function(){return this.Ud},set:function(a){var b=this.Ud;b!==a&&(this.Ud=a,this.N(),this.g("flip",b,a))}},imageAlignment:{get:function(){return this.Vk},
set:function(a){var b=this.Vk;b.A(a)||(this.Vk=a=a.I(),this.N(),this.g("imageAlignment",b,a))}},errorFunction:{get:function(){return this.nd},set:function(a){var b=this.nd;b!==a&&(this.nd=a,this.g("errorFunction",b,a))}},successFunction:{get:function(){return this.oh},set:function(a){var b=this.oh;b!==a&&(this.oh=a,this.g("successFunction",b,a))}},naturalBounds:{get:function(){return this.uc}}});
Qj.prototype.redraw=Qj.prototype.redraw;Qj.prototype.reloadSource=Qj.prototype.DA;var eo=0,go=4;Qj.className="Picture";co=new Xa;Qj.clearCache=Di;function io(){this.Ci=null}function ho(a,b,c,d,e){null===a.Ci&&(a.Ci=[]);var f=new uk(null),g=f.context,h=1/b;f.width=c/b;f.height=d/b;0!==f.width&&0!==f.height&&(b=new jo(f.La,b),c=1,0<a.Ci.length&&(c=a.Ci[a.Ci.length-1],e=c.source,c=c.ratio),g.setTransform(h*c,0,0,h*c,0,0),g.Ed(),g.drawImage(e,0,0),a.Ci.push(b))}io.className="PictureCacheArray";
function jo(a,b){this.source=a;this.ratio=b}jo.className="PictureCacheInstance";function ko(){this.ss=new P;this.jc=null}ko.prototype.reset=function(a){null!==a?(a.ea(),this.ss=a,a.figures.clear()):this.ss=new P;this.jc=null};function td(a,b,c,d,e){a.jc=new $d;a.jc.startX=b;a.jc.startY=c;a.jc.isFilled=d;a.ss.figures.add(a.jc);void 0!==e&&(a.jc.isShadowed=e)}function Bd(a){var b=a.jc.segments.length;0<b&&a.jc.segments.J(b-1).close()}ko.prototype.zm=function(a){this.jc.isShadowed=a};
ko.prototype.moveTo=function(a,b,c){void 0===c&&(c=!1);var d=new ae(Pd);d.endX=a;d.endY=b;c&&d.close();this.jc.segments.add(d)};ko.prototype.lineTo=function(a,b,c){void 0===c&&(c=!1);var d=new ae(rd);d.endX=a;d.endY=b;c&&d.close();this.jc.segments.add(d)};function yd(a,b,c,d,e,f,g){var h;void 0===h&&(h=!1);var k=new ae(Qd);k.point1X=b;k.point1Y=c;k.point2X=d;k.point2Y=e;k.endX=f;k.endY=g;h&&k.close();a.jc.segments.add(k)}
function zd(a,b,c,d,e){var f;void 0===f&&(f=!1);var g=new ae(Rd);g.point1X=b;g.point1Y=c;g.endX=d;g.endY=e;f&&g.close();a.jc.segments.add(g)}ko.prototype.arcTo=function(a,b,c,d,e,f,g){void 0===f&&(f=0);void 0===g&&(g=!1);var h=new ae(Sd);h.startAngle=a;h.sweepAngle=b;h.centerX=c;h.centerY=d;h.radiusX=e;h.radiusY=0!==f?f:e;g&&h.close();this.jc.segments.add(h)};function Ad(a,b,c,d,e,f,g,h){var k;void 0===k&&(k=!1);b=new ae(Td,g,h,b,c,d,e,f);k&&b.close();a.jc.segments.add(b)}
function sd(a){var b=Cd;if(null!==b)return Cd=null,b.reset(a),b;b=new ko;b.reset(a);return b}var Cd=null;ko.className="StreamGeometryContext";function lo(a,b){var c=a.toLowerCase(),d=L.Qe;d[a]=b;d[c]=a}lo("Rectangle",function(a,b,c){a="r"+b+","+c;var d=L.Jf[a];if(void 0!==d)return d;d=new P(P.D);d.endX=b;d.endY=c;L.Kf<L.Hm&&(L.Jf[a]=d,L.Kf++);return d});
lo("Square",function(a,b,c){a="s"+b+","+c;var d=L.Jf[a];if(void 0!==d)return d;d=new P(P.D);d.endX=b;d.endY=c;d.defaultStretch=qg;L.Kf<L.Hm&&(L.Jf[a]=d,L.Kf++);return d});
lo("RoundedRectangle",function(a,b,c){a=a?a.parameter1:NaN;if(isNaN(a)||0>a)a=5;a=Math.min(a,b/3);a=Math.min(a,c/3);var d="rr"+b+","+c+","+a,e=L.Jf[d];if(void 0!==e)return e;var f=a*L.vg;e=(new P).add((new $d(a,0,!0)).add(new ae(rd,b-a,0)).add(new ae(Qd,b,a,b-f,0,b,f)).add(new ae(rd,b,c-a)).add(new ae(Qd,b-a,c,b,c-f,b-f,c)).add(new ae(rd,a,c)).add(new ae(Qd,0,c-a,f,c,0,c-f)).add(new ae(rd,0,a)).add((new ae(Qd,a,0,0,f,f,0)).close()));1<f&&(e.spot1=new N(0,0,f,f),e.spot2=new N(1,1,-f,-f));L.Kf<L.Hm&&
(L.Jf[d]=e,L.Kf++);return e});lo("Border","RoundedRectangle");lo("Ellipse",function(a,b,c){a="e"+b+","+c;var d=L.Jf[a];if(void 0!==d)return d;d=new P(P.L);d.endX=b;d.endY=c;d.spot1=dd;d.spot2=ed;L.Kf<L.Hm&&(L.Jf[a]=d,L.Kf++);return d});lo("Circle",function(a,b,c){a="c"+b+","+c;var d=L.Jf[a];if(void 0!==d)return d;d=new P(P.L);d.endX=b;d.endY=c;d.spot1=dd;d.spot2=ed;d.defaultStretch=qg;L.Kf<L.Hm&&(L.Jf[a]=d,L.Kf++);return d});
lo("TriangleRight",function(a,b,c){return(new P).add((new $d(0,0)).add(new ae(rd,b,.5*c)).add((new ae(rd,0,c)).close())).Am(0,.25,.5,.75)});lo("TriangleDown",function(a,b,c){return(new P).add((new $d(0,0)).add(new ae(rd,b,0)).add((new ae(rd,.5*b,c)).close())).Am(.25,0,.75,.5)});lo("TriangleLeft",function(a,b,c){return(new P).add((new $d(b,c)).add(new ae(rd,0,.5*c)).add((new ae(rd,b,0)).close())).Am(.5,.25,1,.75)});
lo("TriangleUp",function(a,b,c){return(new P).add((new $d(b,c)).add(new ae(rd,0,c)).add((new ae(rd,.5*b,0)).close())).Am(.25,.5,.75,1)});lo("Triangle","TriangleUp");lo("Diamond",function(a,b,c){return(new P).add((new $d(.5*b,0)).add(new ae(rd,0,.5*c)).add(new ae(rd,.5*b,c)).add((new ae(rd,b,.5*c)).close())).Am(.25,.25,.75,.75)});lo("LineH",function(a,b,c){a=new P(P.j);a.startX=0;a.startY=c/2;a.endX=b;a.endY=c/2;return a});
lo("LineV",function(a,b,c){a=new P(P.j);a.startX=b/2;a.startY=0;a.endX=b/2;a.endY=c;return a});lo("None","Rectangle");lo("BarH","Rectangle");lo("BarV","Rectangle");lo("MinusLine","LineH");lo("PlusLine",function(a,b,c){return(new P).add((new $d(0,c/2,!1)).add(new ae(rd,b,c/2)).add(new ae(Pd,b/2,0)).add(new ae(rd,b/2,c)))});lo("XLine",function(a,b,c){return(new P).add((new $d(0,c,!1)).add(new ae(rd,b,0)).add(new ae(Pd,0,0)).add(new ae(rd,b,c)))});
L.Gm={"":"",Standard:"F1 m 0,0 l 8,4 -8,4 2,-4 z",Backward:"F1 m 8,0 l -2,4 2,4 -8,-4 z",Triangle:"F1 m 0,0 l 8,4.62 -8,4.62 z",BackwardTriangle:"F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z",Boomerang:"F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z",BackwardBoomerang:"F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z",SidewaysV:"m 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z",BackwardV:"m 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z",OpenTriangle:"m 0,0 l 8,4 -8,4",BackwardOpenTriangle:"m 8,0 l -8,4 8,4",OpenTriangleLine:"m 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8",
BackwardOpenTriangleLine:"m 8,0 l  -8,4 8,4 m -8.5,0 l 0,-8",OpenTriangleTop:"m 0,0 l 8,4 m 0,4",BackwardOpenTriangleTop:"m 8,0 l -8,4 m 0,4",OpenTriangleBottom:"m 0,8 l 8,-4",BackwardOpenTriangleBottom:"m 0,4 l 8,4",HalfTriangleTop:"F1 m 0,0 l 0,4 8,0 z m 0,8",BackwardHalfTriangleTop:"F1 m 8,0 l 0,4 -8,0 z m 0,8",HalfTriangleBottom:"F1 m 0,4 l 0,4 8,-4 z",BackwardHalfTriangleBottom:"F1 m 8,4 l 0,4 -8,-4 z",ForwardSemiCircle:"m 4,0 b 270 180 0 4 4",BackwardSemiCircle:"m 4,8 b 90 180 0 -4 4",Feather:"m 0,0 l 3,4 -3,4",
BackwardFeather:"m 3,0 l -3,4 3,4",DoubleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardDoubleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4",TripleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardTripleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4",ForwardSlash:"m 0,8 l 5,-8",BackSlash:"m 0,0 l 5,8",DoubleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8",DoubleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8",TripleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8",
TripleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8",Fork:"m 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4",LineFork:"m 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardLineFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8",CircleFork:"F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3",CircleLineFork:"F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",
BackwardCircleLineFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3",Circle:"F1 m 8,4 b 0 360 -4 0 4 z",Block:"F1 m 0,0 l 0,8 8,0 0,-8 z",StretchedDiamond:"F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z",Diamond:"F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z",Chevron:"F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z",StretchedChevron:"F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z",NormalArrow:"F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z",X:"m 0,0 l 8,8 m 0,-8 l -8,8",TailedNormalArrow:"F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z",
DoubleTriangle:"F1 m 0,0 l 4,4 -4,4 0,-8 z  m 4,0 l 4,4 -4,4 0,-8 z",BigEndArrow:"F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z",ConcaveTailArrow:"F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z",RoundedTriangle:"F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z",SimpleArrow:"F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z",AccelerationArrow:"F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z",BoxArrow:"F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z",
TriangleLine:"F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8",CircleEndedArrow:"F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z",DynamicWidthArrow:"F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z",EquilibriumArrow:"m 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3",FastForward:"F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z",Kite:"F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z",HalfArrowTop:"F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8",HalfArrowBottom:"F1 m 0,8 l 4,-4 4,0 -8,4 z",
OpposingDirectionDoubleArrow:"F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z",PartialDoubleTriangle:"F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z",LineCircle:"F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z",DoubleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",TripleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",CircleLine:"F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8",DiamondCircle:"F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z",PlusCircle:"F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8",
OpenRightTriangleTop:"m 8,0 l 0,4 -8,0 m 0,4",OpenRightTriangleBottom:"m 8,8 l 0,-4 -8,0",Line:"m 0,0 l 0,8",DoubleLine:"m 0,0 l 0,8 m 2,0 l 0,-8",TripleLine:"m 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8",PentagonArrow:"F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z"};
function V(a,b){void 0===a||a instanceof El||"string"===typeof a?X.call(this,a):(X.call(this),a&&(b=a));this.F=2408959;this.Tg=this.Nf="";this.Yo=this.Uo=this.hp=this.eo=null;this.jp="";this.Lf=this.On=this.ip=this.jh=null;this.Wo="";this.Vo=Mb;this.Xb=this.Zo="";this.fi=this.Zm=this.Rh=null;this.Wf=(new J(NaN,NaN)).freeze();this.lo="";this.cf=null;this.mo=tc;this.$o=Tc;this.uo=rb;this.no=sb;this.pn=null;this.fo=127;this.op=tb;this.np="gray";this.gg=4;this.Sw=-1;this.Kp=NaN;this.Oy=new M;this.li=
null;this.Xf=NaN;b&&Object.assign(this,b)}ma(V,X);
V.prototype.cloneProtected=function(a){X.prototype.cloneProtected.call(this,a);a.F=this.F&-4097|49152;a.Nf=this.Nf;a.Tg=this.Tg;a.eo=this.eo;a.hp=this.hp;a.Uo=this.Uo;a.Yo=this.Yo;a.jp=this.jp;a.ip=this.ip;a.On=this.On;a.Lf=null;a.Wo=this.Wo;a.Vo=this.Vo.I();a.Zo=this.Zo;a.$o=this.$o.I();a.Xb=this.Xb;a.Zm=this.Zm;a.Wf.assign(this.Wf);a.lo=this.lo;a.mo=this.mo.I();a.uo=this.uo.I();a.no=this.no.I();a.pn=this.pn;a.fo=this.fo;a.op=this.op.I();a.np=this.np;a.gg=this.gg;a.Kp=this.Kp};
V.prototype.wf=function(a){X.prototype.wf.call(this,a);a.Gh();a.jh=null;a.cf=null;a.li=null};V.prototype.toString=function(){var a=Ka(this.constructor)+"#"+fb(this);null!==this.data&&(a+="("+La(this.data)+")");return a};V.prototype.nk=function(a,b,c,d,e,f,g){var h=this.diagram;null!==h&&(a===ie&&"elements"===b?e instanceof X?uj(e,function(a){wj(h.partManager,a);vj(h,a)}):Pj(h,e):a===pe&&"elements"===b&&(e instanceof X?uj(e,function(a){zj(h.partManager,a,h)}):Rj(h,e)),h.Wa(a,b,c,d,e,f,g))};
V.prototype.Fa=function(a){X.prototype.Fa.call(this,a);if(null!==this.data){for(var b=this.T.m,c=b.length,d=0;d<c;d++){var e=b[d];e instanceof X&&uj(e,function(a){null!==a.data&&a.Fa()})}for(b=this.adornments;b.next();)b.value.Fa(a)}};V.prototype.updateRelationshipsFromData=function(){var a;null!==this.data&&(null===(a=this.diagram)||void 0===a?void 0:a.partManager.updateRelationshipsFromData(this))};V.prototype.Wj=function(a){var b=this.Lf;return null===b?null:b.H(a)};
V.prototype.xh=function(a,b){if(null!==b){var c=null,d=this.Lf;null!==d&&(c=d.H(a));if(c!==b){if(null!==c){var e=c.diagram;null!==e&&e.remove(c)}null===d&&(this.Lf=d=new I);b.Nf!==a&&(b.category=a);d.add(a,b);a=this.diagram;null!==a&&(a.add(b),a=b.adornedObject,null!==a&&(a=a.Ch(),null!==a&&(b.data=a.data)))}}};V.prototype.Gf=function(a){var b=this.Lf;if(null!==b){var c=b.H(a);if(null!==c){var d=c.diagram;null!==d&&d.remove(c)}b.remove(a);0===b.count&&(this.Lf=null)}};
V.prototype.Oj=function(){var a=this.Lf;if(null!==a){var b=Ga();for(a=a.iterator;a.next();)b.push(a.key);a=b.length;for(var c=0;c<a;c++)this.Gf(b[c]);Ja(b)}};
V.prototype.updateAdornments=function(){var a=this.diagram;if(null!==a){for(var b=this.adornments;b.next();){var c=b.value;c.s();c.placeholder&&c.placeholder.s()}a:{if(this.isSelected&&this.selectionAdorned&&(b=this.selectionObject,null!==b&&this.actualBounds.u()&&this.isVisible()&&b.Ff()&&b.actualBounds.u())){c=this.Wj("Selection");if(null===c){c=this.selectionAdornmentTemplate;null===c&&(c=this.Hh()?a.linkSelectionAdornmentTemplate:this instanceof U?a.groupSelectionAdornmentTemplate:a.nodeSelectionAdornmentTemplate);
if(!(c instanceof ye))break a;ng(c);c=c.copy();null!==c&&(this.Hh()&&this.selectionObject===this.path&&(c.type=X.Link),c.adornedObject=b)}if(null!==c){c.type===X.Link&&c.s();this.xh("Selection",c);break a}}this.Gf("Selection")}mo(this,a);for(b=this.adornments;b.next();)b.value.Fa()}};V.prototype.Lb=function(){var a=this.diagram;null!==a&&(Li(a),0!==(this.F&16384)!==!0&&(this.F|=16384,a.Fb()))};function ai(a){0!==(a.F&16384)!==!1&&(a.updateAdornments(),a.F&=-16385)}
function mo(a,b){b.toolManager.mouseDownTools.each(function(b){b.isEnabled&&b.updateAdornments(a)});b.toolManager.updateAdornments(a)}function no(a){if(!1===jj(a)){oo(a,!0);a.bl();var b=a.diagram;null!==b&&(b.te.add(a),b.Fb())}}function po(a){a.F|=2097152;if(!1!==jj(a)){var b=a.position,c=a.location;c.u()&&b.u()||qo(a,b,c);c=a.xb;var d=M.alloc().assign(c);c.ea();c.x=b.x;c.y=b.y;c.freeze();a.hm(d,c);M.free(d);oo(a,!1)}}
V.prototype.xe=function(a,b,c,d){var e=this.lc;e.h(a,b,c,d);null===this.Bb&&(this.Bb=new nd);var f=this.Bb;f.reset();this.mp(f,a,b,c,d);this.Bb=f;f.Bs()||f.wq(e)};
V.prototype.mp=function(a,b,c,d,e){1!==this.sa&&a.scale(this.sa);if(0!==this.zb){var f=xc;this.locationSpot.hb()&&(f=this.locationSpot);var g=J.alloc();if(this.locationObject!==this)for(b=this.locationObject,c=b.naturalBounds,g.Ui(c.x,c.y,c.width,c.height,f),null!==b.Bb&&b.Bb.Aa(g),g.offset(-b.measuredBounds.x,-b.measuredBounds.y),f=b.panel;null!==f&&f!==this;)null!==f.Bb&&f.Bb.Aa(g),g.offset(-f.measuredBounds.x,-f.measuredBounds.y),f=f.panel;else g.Ui(b,c,d,e,f);a.rotate(this.zb,g.x,g.y);J.free(g)}};
V.prototype.move=function(a,b){!0===b?this.location=a:this.position=a};V.prototype.moveTo=function(a,b,c){a=J.allocAt(a,b);this.move(a,c);J.free(a)};V.prototype.isVisible=function(){if(!this.visible)return!1;var a=this.layer;if(null!==a){if(!a.visible)return!1;a=a.diagram;if(null!==a&&a.animationManager.Ls(this))return!0}a=this.containingGroup;return null===a||a.isSubGraphExpanded&&a.isVisible()?!0:!1};
V.prototype.Ob=function(a){var b=this.diagram;a?(this.B(4),this.Lb(),null!==b&&b.te.add(this)):(this.B(8),this.Oj());this.Gh();null!==b&&(b.Qa(),b.N())};V.prototype.Ya=function(a){if(this.name===a)return this;var b=this.li;null===b&&(this.li=b=new I);if(null!==b.H(a))return b.H(a);var c=X.prototype.Ya.call(this,a);if(null!==c)return b.set(a,c),c;b.set(a,null);return null};
function ro(a,b,c,d){void 0===d&&(d=new J);c=c.Ac()?xc:c;var e=b.naturalBounds;d.h(e.width*c.x+c.offsetX,e.height*c.y+c.offsetY);if(null===b||b===a)return d;b.transform.Aa(d);for(b=b.panel;null!==b&&b!==a;)b.transform.Aa(d),b=b.panel;null!==a.Bb&&a.Bb.Aa(d);d.offset(-a.lc.x,-a.lc.y);return d}V.prototype.Li=function(a){void 0===a&&(a=new M);return a.assign(this.actualBounds)};V.prototype.Ta=function(){!0===hj(this)&&this.measure(Infinity,Infinity);this.arrange()};
function sj(a,b){var c=a.Oy;isNaN(a.Xf)&&(a.Xf=Wm(a));var d=a.Xf;var e=2*d;if(!a.isShadowed)return c.h(b.x-1-d,b.y-1-d,b.width+2+e,b.height+2+e),c;d=b.x;e=b.y;var f=b.width;b=b.height;var g=a.shadowBlur;a=a.shadowOffset;f+=g;b+=g;d-=g/2;e-=g/2;0<a.x?f+=a.x:(d+=a.x,f-=a.x);0<a.y?b+=a.y:(e+=a.y,b-=a.y);c.h(d-1,e-1,f+2,b+2);return c}
V.prototype.arrange=function(){if(!1===ij(this))po(this);else{cl(this,!1);var a=this.xb,b=M.alloc();b.assign(a);var c=lg(this);this.zh(0,0,this.lc.width,this.lc.height);var d=this.position;qo(this,d,this.location);a.ea();a.x=d.x;a.y=d.y;a.freeze();this.hm(b,a);b.A(a)?this.Md(c):!this.Nc()||L.w(b.width,a.width)&&L.w(b.height,a.height)||0<=this.Sw&&this.B(16);M.free(b);oo(this,!1)}};t=V.prototype;
t.hm=function(a,b){var c=this.diagram;if(null!==c){var d=!1;if(!1===c.jj&&a.u()){var e=M.alloc();e.assign(c.documentBounds);e.Nv(c.padding);a.x>e.x&&a.y>e.y&&a.right<e.right&&a.bottom<e.bottom&&b.x>e.x&&b.y>e.y&&b.right<e.right&&b.bottom<e.bottom&&(d=!0);M.free(e)}0!==(this.F&65536)!==!0&&a.A(b)||xj(this,d,c);c.N();!a.u()&&!b.u()||Tb(a,b)||(this instanceof W&&!c.undoManager.isUndoingRedoing&&this.sd(),this.Gh())}};
t.Jv=function(a,b,c){if(this.Hh()||!a.u())return!1;var d=this.diagram;null!==d&&so(this,d,a,b,c);this.ja=a;this.F&=-2097153;var e=this.Wf;!e.u()||null!==d&&!d.animationManager.isTicking&&d.undoManager.isUndoingRedoing||(d=e.copy(),e.h(e.x+(a.x-b),e.y+(a.y-c)),this.g("location",d,e.copy()));!1===jj(this)&&!1===ij(this)&&(no(this),po(this));return!0};function so(a,b,c,d,e){null===b||a instanceof ye||(b=b.animationManager,b.tb&&Dh(b,a,new J(d,e),c))}
t.wm=function(a,b,c){var d=this.Wf,e=this.ja;if(c){if(d.x===a&&d.y===b)return;jj(this)||ij(this)?e.h(NaN,NaN):e.h(e.x+a-d.x,e.y+b-d.y);d.h(a,b)}else{if(e.x===a&&e.y===b)return;jj(this)||ij(this)?this.Us():d.h(d.x+a-e.x,d.y+b-e.y);e.h(a,b)}no(this)};t.Us=function(){this.F&=-2097153;no(this)};
function qo(a,b,c){var d=J.alloc(),e=a.locationObject,f=e.naturalBounds,g=e instanceof xf?e.strokeWidth:0;d.Ui(0,0,f.width+g,f.height+g,a.locationSpot);if(e!==a)for(d.offset(-g/2,-g/2),e.transform.Aa(d),e=e.panel;null!==e&&e!==a;)e.transform.Aa(d),e=e.panel;null!==a.Bb&&a.Bb.Aa(d);d.offset(-a.lc.x,-a.lc.y);e=a.diagram;f=c.u();g=b.u();f&&g?0!==(a.F&2097152)?to(a,b,c,e,d):uo(a,b,c,e,d):f?to(a,b,c,e,d):g&&uo(a,b,c,e,d);a.F|=2097152;J.free(d);a.bl()}
function to(a,b,c,d,e){var f=b.x,g=b.y;b.h(c.x-e.x,c.y-e.y);null!==d&&(c=d.animationManager,(d=c.defaultAnimation.isAnimating)||!c.tb||a instanceof ye||Dh(c,a,new J(f,g),b),d||b.x===f&&b.y===g||a.g("position",new J(f,g),b.copy()))}function uo(a,b,c,d,e){var f=c.copy();c.h(b.x+e.x,b.y+e.y);c.A(f)||null===d||a.g("location",f,c.copy())}
function xj(a,b,c){el(a,!1);a instanceof W&&pk(c,a);a.layer.isTemporary||b||c.Qa();b=a.xb;var d=c.viewportBounds;d.u()?lg(a)?(Zb(b,d)||a.Md(!1),a.updateAdornments()):b.Mc(d)?(a.Md(!0),a.updateAdornments()):a.Lb():c.lj=!0}t.Ri=function(){return!0};t.Nc=function(){return!0};t.Hh=function(){return!1};t.Qi=function(){return!0};
function vo(a,b,c,d){b.constructor===a.constructor||wo||(wo=!0,ya('Should not change the class of the Part when changing category from "'+c+'" to "'+d+'"'),ya("  Old class: "+Ka(a.constructor)+", new class: "+Ka(b.constructor)+", part: "+a.toString()));a.Oj();var e=a.data;c=a.layerName;var f=a.isSelected,g=a.isHighlighted,h=!0,k=!0,l=!1;a instanceof W&&(h=a.isTreeLeaf,k=a.isTreeExpanded,l=a.wasTreeExpanded);b.wf(a);b.cloneProtected(a);a.Nf=d;a.s();a.N();b=a.diagram;d=!0;null!==b&&(d=b.skipsUndoManager,
b.skipsUndoManager=!0);a.jb=e;a.F=f?a.F|4096:a.F&-4097;a.F=g?a.F|524288:a.F&-524289;a instanceof W&&(a.R=h?a.R|4:a.R&-5,a.R=k?a.R|1:a.R&-2,a.R=l?a.R|2:a.R&-3);null!==e&&a.Fa();e=a.layerName;e!==c&&(a.Tg=c,a.layerName=e);null!==b&&(b.skipsUndoManager=d);a.Nc()&&a.B(64)}V.prototype.canCopy=function(){if(!this.copyable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowCopy)return!1;a=a.diagram;return null===a?!0:a.allowCopy?!0:!1};
V.prototype.canDelete=function(){if(!this.deletable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowDelete)return!1;a=a.diagram;return null===a?!0:a.allowDelete?!0:!1};V.prototype.canEdit=function(){if(!this.textEditable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowTextEdit)return!1;a=a.diagram;return null===a?!0:a.allowTextEdit?!0:!1};
V.prototype.canGroup=function(){if(!this.groupable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowGroup)return!1;a=a.diagram;return null===a?!0:a.allowGroup?!0:!1};V.prototype.canMove=function(){if(!this.movable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowMove)return!1;a=a.diagram;return null===a?!0:a.allowMove?!0:!1};
V.prototype.canReshape=function(){if(!this.reshapable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowReshape)return!1;a=a.diagram;return null===a?!0:a.allowReshape?!0:!1};V.prototype.canResize=function(){if(!this.resizable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowResize)return!1;a=a.diagram;return null===a?!0:a.allowResize?!0:!1};
V.prototype.canRotate=function(){if(!this.rotatable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRotate)return!1;a=a.diagram;return null===a?!0:a.allowRotate?!0:!1};V.prototype.canSelect=function(){if(!this.selectable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowSelect)return!1;a=a.diagram;return null===a?!0:a.allowSelect?!0:!1};function jj(a){return 0!==(a.F&32768)}function oo(a,b){a.F=b?a.F|32768:a.F&-32769}function el(a,b){a.F=b?a.F|65536:a.F&-65537}
function lg(a){return 0!==(a.F&131072)}t=V.prototype;t.Md=function(a){this.F=a?this.F|131072:this.F&-131073};function xo(a,b){a.F=b?a.F|1048576:a.F&-1048577}t.Gh=function(){var a=this.containingGroup;null!==a&&(a.s(),null!==a.placeholder&&a.placeholder.s(),a.sd())};t.N=function(){var a=this.diagram;null!==a&&!ij(this)&&!jj(this)&&this.isVisible()&&this.xb.u()&&a.N(sj(this,this.xb))};
t.s=function(){X.prototype.s.call(this);var a=this.diagram;null!==a&&(a.te.add(this),this instanceof W&&null!==this.labeledLink&&tl(this.labeledLink),a.Fb(!0))};t.bq=function(a){a||(a=this.Rh,null!==a&&yo(a,this))};t.cq=function(a){a||(a=this.Rh,null!==a&&zo(a,this))};t.Uj=function(){var a=this.data;if(null!==a){var b=this.diagram;null!==b&&(b=b.model,null!==b&&b.mm(a))}};t.Nz=function(){return Ao(this,this)};
function Ao(a,b){var c=b.containingGroup;return null!==c?1+Ao(a,c):b instanceof W&&(b=b.labeledLink,null!==b)?Ao(a,b):0}t.Rz=function(){return Bo(this,this)};function Bo(a,b){var c=b.containingGroup;return null!==c||b instanceof W&&(c=b.labeledLink,null!==c)?Bo(a,c):b}t.Jd=function(a){return a instanceof U?Co(this,this,a):!1};function Co(a,b,c){if(b===c||null===c)return!1;var d=b.containingGroup;return null===d||d!==c&&!Co(a,d,c)?b instanceof W&&(b=b.labeledLink,null!==b)?Co(a,b,c):!1:!0}
t.Lx=function(a){if(null===a)return null;if(this===a)return this.containingGroup;for(var b=this;null!==b;){b instanceof U&&xo(b,!0);if(b instanceof W){var c=b.labeledLink;null!==c&&(b=c)}b=b.containingGroup}c=null;for(b=a;null!==b;){if(0!==(b.F&1048576)){c=b;break}b instanceof W&&(a=b.labeledLink,null!==a&&(b=a));b=b.containingGroup}for(b=this;null!==b;)b instanceof U&&xo(b,!1),b instanceof W&&(a=b.labeledLink,null!==a&&(b=a)),b=b.containingGroup;return c};
V.prototype.canLayout=function(){if(!this.isLayoutPositioned||!this.isVisible())return!1;var a=this.layer;return null!==a&&a.isTemporary||this instanceof W&&this.isLinkLabel?!1:!0};
V.prototype.B=function(a){void 0===a&&(a=16777215);if(this.isLayoutPositioned&&0!==(a&this.layoutConditions)){var b=this.layer;null!==b&&b.isTemporary||this instanceof W&&this.isLinkLabel?b=!1:(b=this.diagram,b=null!==b&&b.undoManager.isUndoingRedoing?!1:!0)}else b=!1;if(b)if(b=this.Rh,null!==b){var c=b.layout;null!==c?c.B():b.B(a)}else a=this.diagram,null!==a&&(a=a.layout,null!==a&&a.B())};function yj(a){if(!a.isVisible())return!1;a=a.layer;return null!==a&&a.isTemporary?!1:!0}
function Lk(a,b,c,d,e,f){void 0===f&&(f=null);if(!(a.contains(b)||null!==f&&!f(b)||b instanceof ye))if(a.add(b),b instanceof W){if(c&&b instanceof U)for(var g=b.memberParts;g.next();)Lk(a,g.value,c,d,e,f);if(!1!==e)for(g=b.linksConnected;g.next();){var h=g.value;if(!a.contains(h)){var k=h.fromNode,l=h.toNode;k=null===k||a.contains(k);l=null===l||a.contains(l);(e?k&&l:k||l)&&Lk(a,h,c,d,e,f)}}if(1<d)for(b=b.Ru();b.next();)Lk(a,b.value,c,d-1,e,f)}else if(b instanceof T)for(b=b.labelNodes;b.next();)Lk(a,
b.value,c,d,e,f)}
na.Object.defineProperties(V.prototype,{key:{get:function(){var a=this.diagram;if(null!==a)return a.model.pa(this.data)}},adornments:{get:function(){return null===this.Lf?$a:this.Lf.iteratorValues}},layer:{get:function(){return this.fi}},diagram:{get:function(){var a=this.fi;return null===a||void 0===a?null:a.diagram}},layerName:{get:function(){return this.Tg},set:function(a){var b=
this.Tg;if(b!==a){var c=this.diagram;if(null===c||null!==c.Xj(a)&&!c.partManager.addsToTemporaryLayer)if(this.Tg=a,null!==c&&c.Qa(),this.g("layerName",b,a),b=this.layer,null!==b&&b.name!==a&&(c=b.diagram,null!==c&&(a=c.Xj(a),null!==a&&a!==b))){var d=b.ec(-1,this,!0);0<=d&&c.Wa(pe,"parts",b,this,null,d,!0);d=a.Ni(99999999,this,!0);b.visible!==a.visible&&this.Ob(a.visible);0<=d&&c.Wa(ie,"parts",a,null,this,!0,d);d=this.layerChanged;if(null!==d){var e=c.Z;c.Z=!0;d(this,b,a);c.Z=e}}}}},layerChanged:{
get:function(){return this.eo},set:function(a){var b=this.eo;b!==a&&(this.eo=a,this.g("layerChanged",b,a))}},zOrder:{get:function(){return this.Kp},set:function(a){var b=this.Kp;if(b!==a){this.Kp=a;var c=this.layer;null!==c&&di(c,-1,this);this.g("zOrder",b,a);a=this.diagram;null!==a&&a.N()}}},locationObject:{get:function(){if(null===this.cf){var a=this.locationObjectName;""!==a?(a=this.Ya(a),null!==a?this.cf=a:this.cf=this):
this instanceof ye?this.type!==X.Link&&null!==this.placeholder?this.cf=this.placeholder:this.cf=this:this.cf=this}return this.cf.visible?this.cf:this}},minLocation:{get:function(){return this.uo},set:function(a){var b=this.uo;b.A(a)||(this.uo=a=a.I(),this.g("minLocation",b,a))}},maxLocation:{get:function(){return this.no},set:function(a){var b=this.no;b.A(a)||(this.no=a=a.I(),this.g("maxLocation",b,a))}},locationObjectName:{
get:function(){return this.lo},set:function(a){var b=this.lo;b!==a&&(this.lo=a,this.cf=null,this.s(),this.g("locationObjectName",b,a))}},locationSpot:{get:function(){return this.mo},set:function(a){var b=this.mo;b.A(a)||(this.mo=a=a.I(),this.s(),this.g("locationSpot",b,a))}},location:{get:function(){return this.Wf},set:function(a){var b=a.x,c=a.y,d=this.Wf;if(!(d.x===b||isNaN(d.x)&&isNaN(b))||!(d.y===c||isNaN(d.y)&&isNaN(c))){a=
a.copy();b=a;if(this.Hh())b=!1;else{this.Wf=b;this.F|=2097152;if(!1===ij(this)&&(no(this),c=this.ja,c.u())){var e=this.diagram;if(null===e||e.animationManager.isTicking||!e.undoManager.isUndoingRedoing){var f=c.copy();c.h(c.x+(b.x-d.x),c.y+(b.y-d.y));so(this,e,c,f.x,f.y);this.g("position",f,c.copy())}}b=!0}b&&this.g("location",d,a.copy())}}},category:{get:function(){return this.Nf},set:function(a){var b=this.Nf;if(b!==a){var c=this.diagram,d=this.data,e=null;if(null!==
c&&null!==d&&!(this instanceof ye)){var f=c.model.undoManager;f.isEnabled&&!f.isUndoingRedoing&&(e=this.clone(),e.T.addAll(this.T))}this.Nf=a;this.g("category",b,a);null===c||null===d||this instanceof ye?this instanceof ye&&(e=this.adornedPart,null!==e&&(a=e.Lf,null!==a&&a.remove(b),e.xh(this.category,this))):(f=c.model,f.undoManager.isUndoingRedoing||(this.Hh()?(c.partManager.setLinkCategoryForData(d,a),c=c.partManager.findLinkTemplateForCategory(a),null!==c&&(ng(c),c=c.copy(),null!==c&&vo(this,
c,b,a))):(null!==f&&f.tm(d,a),c=Do(c.partManager,d,a),null!==c&&(ng(c),c=c.copy(),null===c||c instanceof T||(d=this.location.copy(),vo(this,c,b,a),this.location.u()||(this.location=d)))),null!==e&&(b=this.clone(),b.T.addAll(this.T),this.g("self",e,b))))}}},self:{get:function(){return this},set:function(a){vo(this,a,this.category,a.category)}},copyable:{get:function(){return 0!==(this.F&1)},set:function(a){var b=0!==(this.F&1);b!==a&&(this.F^=
1,this.g("copyable",b,a))}},deletable:{get:function(){return 0!==(this.F&2)},set:function(a){var b=0!==(this.F&2);b!==a&&(this.F^=2,this.g("deletable",b,a))}},textEditable:{get:function(){return 0!==(this.F&4)},set:function(a){var b=0!==(this.F&4);b!==a&&(this.F^=4,this.g("textEditable",b,a),this.Lb())}},groupable:{get:function(){return 0!==(this.F&8)},set:function(a){var b=0!==(this.F&8);b!==a&&(this.F^=8,this.g("groupable",
b,a))}},movable:{get:function(){return 0!==(this.F&16)},set:function(a){var b=0!==(this.F&16);b!==a&&(this.F^=16,this.g("movable",b,a))}},selectionAdorned:{get:function(){return 0!==(this.F&32)},set:function(a){var b=0!==(this.F&32);b!==a&&(this.F^=32,this.g("selectionAdorned",b,a),this.Lb())}},isInDocumentBounds:{get:function(){return 0!==(this.F&64)},set:function(a){var b=0!==(this.F&64);if(b!==a){this.F^=
64;var c=this.diagram;null!==c&&c.Qa();this.g("isInDocumentBounds",b,a)}}},isLayoutPositioned:{get:function(){return 0!==(this.F&128)},set:function(a){var b=0!==(this.F&128);b!==a&&(this.F^=128,this.g("isLayoutPositioned",b,a),this.B(a?4:8))}},selectable:{get:function(){return 0!==(this.F&256)},set:function(a){var b=0!==(this.F&256);b!==a&&(this.F^=256,this.g("selectable",b,a),this.Lb())}},reshapable:{get:function(){return 0!==
(this.F&512)},set:function(a){var b=0!==(this.F&512);b!==a&&(this.F^=512,this.g("reshapable",b,a),this.Lb())}},resizable:{get:function(){return 0!==(this.F&1024)},set:function(a){var b=0!==(this.F&1024);b!==a&&(this.F^=1024,this.g("resizable",b,a),this.Lb())}},rotatable:{get:function(){return 0!==(this.F&2048)},set:function(a){var b=0!==(this.F&2048);b!==a&&(this.F^=2048,this.g("rotatable",b,a),this.Lb())}},isSelected:{
get:function(){return 0!==(this.F&4096)},set:function(a){var b=0!==(this.F&4096);if(b!==a){var c=this.diagram;if(!a||this.canSelect()&&!(null!==c&&c.selection.count>=c.maxSelectionCount)){this.F^=4096;var d=!1;if(null!==c){d=c.skipsUndoManager;c.skipsUndoManager=!0;var e=c.selection;e.ea();a?e.add(this):e.remove(this);e.freeze()}this.g("isSelected",b,a);this.Lb();a=this.selectionChanged;null!==a&&a(this);null!==c&&(c.Fb(),c.skipsUndoManager=d)}}}},isHighlighted:{get:function(){return 0!==
(this.F&524288)},set:function(a){var b=0!==(this.F&524288);if(b!==a){this.F^=524288;var c=this.diagram;null!==c&&(c=c.highlighteds,c.ea(),a?c.add(this):c.remove(this),c.freeze());this.g("isHighlighted",b,a);this.N();a=this.highlightedChanged;null!==a&&a(this)}}},isShadowed:{get:function(){return 0!==(this.F&8192)},set:function(a){var b=0!==(this.F&8192);b!==a&&(this.F^=8192,this.g("isShadowed",b,a),this.N())}},isAnimated:{get:function(){return 0!==
(this.F&262144)},set:function(a){var b=0!==(this.F&262144);b!==a&&(this.F^=262144,this.g("isAnimated",b,a))}},highlightedChanged:{get:function(){return this.On},set:function(a){var b=this.On;b!==a&&(this.On=a,this.g("highlightedChanged",b,a))}},selectionObjectName:{get:function(){return this.jp},set:function(a){var b=this.jp;b!==a&&(this.jp=a,this.jh=null,this.g("selectionObjectName",b,a))}},selectionAdornmentTemplate:{
get:function(){return this.hp},set:function(a){var b=this.hp;b!==a&&(this.hp=a,this.g("selectionAdornmentTemplate",b,a))}},selectionObject:{get:function(){if(null===this.jh){var a=this.selectionObjectName;null!==a&&""!==a?(a=this.Ya(a),null!==a?this.jh=a:this.jh=this):this instanceof T?(a=this.path,null!==a?this.jh=a:this.jh=this):this.jh=this}return this.jh}},selectionChanged:{get:function(){return this.ip},set:function(a){var b=this.ip;
b!==a&&(this.ip=a,this.g("selectionChanged",b,a))}},resizeAdornmentTemplate:{get:function(){return this.Uo},set:function(a){var b=this.Uo;b!==a&&(this.Uo=a,this.g("resizeAdornmentTemplate",b,a))}},resizeObjectName:{get:function(){return this.Wo},set:function(a){var b=this.Wo;b!==a&&(this.Wo=a,this.g("resizeObjectName",b,a))}},resizeObject:{get:function(){var a=this.resizeObjectName;return""!==a&&(a=this.Ya(a),
null!==a)?a:this}},resizeCellSize:{get:function(){return this.Vo},set:function(a){var b=this.Vo;b.A(a)||(this.Vo=a=a.I(),this.g("resizeCellSize",b,a))}},rotateAdornmentTemplate:{get:function(){return this.Yo},set:function(a){var b=this.Yo;b!==a&&(this.Yo=a,this.g("rotateAdornmentTemplate",b,a))}},rotateObjectName:{get:function(){return this.Zo},set:function(a){var b=this.Zo;b!==a&&(this.Zo=a,this.g("rotateObjectName",
b,a))}},rotateObject:{get:function(){var a=this.rotateObjectName;return""!==a&&(a=this.Ya(a),null!==a)?a:this}},rotationSpot:{get:function(){return this.$o},set:function(a){var b=this.$o;b.A(a)||(this.$o=a=a.I(),this.g("rotationSpot",b,a))}},text:{get:function(){return this.Xb},set:function(a){var b=this.Xb;b!==a&&(this.Xb=a,this.g("text",b,a))}},containingGroup:{get:function(){return this.Rh},
set:function(a){if(this.Nc()){var b=this.Rh;if(b!==a){null===a||this!==a&&!a.Jd(this)||(this===a&&C("Cannot make a Group a member of itself: "+this.toString()),C("Cannot make a Group indirectly contain itself: "+this.toString()+" already contains "+a.toString()));this.B(2);var c=this.diagram;null!==b?zo(b,this):this instanceof U&&null!==c&&c.wi.remove(this);this.Rh=a;null!==a?yo(a,this):this instanceof U&&null!==c&&c.wi.add(this);this.B(1);if(null!==c&&c.Z){var d=this.data,e=c.model;if(null!==d&&
e.ck()){var f=e.pa(null!==a?a.data:null);e.tq(d,f)}}d=this.containingGroupChanged;null!==d&&(e=!0,null!==c&&(e=c.Z,c.Z=!0),d(this,b,a),null!==c&&(c.Z=e));if(this instanceof U)for(c=new G,Lk(c,this,!0,0,!0),c=c.iterator;c.next();)if(d=c.value,d instanceof W)for(d=d.linksConnected;d.next();)Eo(d.value);if(this instanceof W){for(c=this.linksConnected;c.next();)Eo(c.value);c=this.labeledLink;null!==c&&Eo(c)}this.g("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&di(b,-1,a))}}else C("cannot set the Part.containingGroup of a Link or Adornment")}},
containingGroupChanged:{get:function(){return this.Zm},set:function(a){var b=this.Zm;b!==a&&(this.Zm=a,this.g("containingGroupChanged",b,a))}},isTopLevel:{get:function(){return null!==this.containingGroup||this instanceof W&&null!==this.labeledLink?!1:!0}},layoutConditions:{get:function(){return this.fo},set:function(a){var b=this.fo;b!==a&&(this.fo=a,this.g("layoutConditions",b,a))}},dragComputation:{
get:function(){return this.pn},set:function(a){var b=this.pn;b!==a&&(this.pn=a,this.g("dragComputation",b,a))}},shadowOffset:{get:function(){return this.op},set:function(a){var b=this.op;b.A(a)||(this.op=a=a.I(),this.N(),this.g("shadowOffset",b,a))}},shadowColor:{get:function(){return this.np},set:function(a){var b=this.np;b!==a&&(this.np=a,this.N(),this.g("shadowColor",b,a))}},shadowBlur:{get:function(){return this.gg},
set:function(a){var b=this.gg;b!==a&&(this.gg=a,this.N(),this.g("shadowBlur",b,a))}}});V.prototype.invalidateLayout=V.prototype.B;V.prototype.findCommonContainingGroup=V.prototype.Lx;V.prototype.isMemberOf=V.prototype.Jd;V.prototype.findTopLevelPart=V.prototype.Rz;V.prototype.findSubGraphLevel=V.prototype.Nz;V.prototype.ensureBounds=V.prototype.Ta;V.prototype.getDocumentBounds=V.prototype.Li;V.prototype.findObject=V.prototype.Ya;V.prototype.moveTo=V.prototype.moveTo;
V.prototype.invalidateAdornments=V.prototype.Lb;V.prototype.clearAdornments=V.prototype.Oj;V.prototype.removeAdornment=V.prototype.Gf;V.prototype.addAdornment=V.prototype.xh;V.prototype.findAdornment=V.prototype.Wj;V.prototype.updateTargetBindings=V.prototype.Fa;var wo=!1;V.className="Part";V.LayoutNone=0;V.LayoutAdded=1;V.LayoutRemoved=2;V.LayoutShown=4;V.LayoutHidden=8;V.LayoutNodeSized=16;V.LayoutGroupLayout=32;V.LayoutNodeReplaced=64;V.LayoutStandard=127;V.LayoutAll=16777215;
function ye(a,b){void 0===a||a instanceof El||"string"===typeof a?V.call(this,a):(V.call(this),a&&(b=a));this.F&=-257;this.Tg="Adornment";this.le=null;this.Ww=0;this.qx=!1;this.j=this.Sa=null;b&&Object.assign(this,b)}ma(ye,V);ye.prototype.toString=function(){var a=this.adornedPart;return"Adornment("+this.category+")"+(null!==a?a.toString():"")};ye.prototype.updateRelationshipsFromData=function(){};
ye.prototype.fk=function(a){var b=this.adornedObject,c=null===b||void 0===b?void 0:b.part;if(c instanceof T&&b instanceof xf){b=c.path;c.fk(a);a=b.geometry;c=this.T.m;b=c.length;for(var d=0;d<b;d++){var e=c[d];e.isPanelMain&&e instanceof xf&&(e.ma=a)}}};ye.prototype.Ri=function(){var a=this.le;if(null===a)return!0;a=a.part;return null===a||!ij(a)};ye.prototype.Nc=function(){return!1};
ye.prototype.nk=function(a,b,c,d,e,f,g){if(a===ie&&"elements"===b)if(e instanceof mg)null===this.Sa&&(this.Sa=e);else{if(e instanceof X){var h=e.Yl(function(a){return a instanceof mg});h instanceof mg&&null===this.Sa&&(this.Sa=h)}}else a===pe&&"elements"===b&&null!==this.Sa&&(d===this.Sa?this.Sa=null:d instanceof X&&this.Sa.rg(d)&&(this.Sa=null));V.prototype.nk.call(this,a,b,c,d,e,f,g)};ye.prototype.updateAdornments=function(){};ye.prototype.Uj=function(){};
na.Object.defineProperties(ye.prototype,{placeholder:{get:function(){return this.Sa}},adornedObject:{get:function(){return this.le},set:function(a){var b=this.adornedPart,c=null;null!==a&&(c=a.part);null===b||null!==a&&b===c||b.Gf(this.category);this.le=a;null!==c&&c.xh(this.category,this)}},adornedPart:{get:function(){var a=this.le;return null!==a?a.part:null}},containingGroup:{
get:function(){return null}}});ye.className="Adornment";function W(a,b){void 0===a||a instanceof El||"string"===typeof a?V.call(this,a):(V.call(this),a&&(b=a));this.R=13;this.ab=new F;this.Dp=this.gl=this.ii=this.io=this.ho=null;this.Ak=pc;this.nc=this.Te=null;this.Ro=Fo;this.vh=!1;b&&Object.assign(this,b)}ma(W,V);W.prototype.cloneProtected=function(a){V.prototype.cloneProtected.call(this,a);a.R=this.R;a.R=this.R&-17;a.ho=this.ho;a.io=this.io;a.ii=this.ii;a.Dp=this.Dp;a.Ak=this.Ak.I();a.Ro=this.Ro};
t=W.prototype;t.wf=function(a){V.prototype.wf.call(this,a);a.sd();a.Te=this.Te;a.nc=null};function Go(a,b){null!==b&&(null===a.Te&&(a.Te=new G),a.Te.add(b))}function Ho(a,b,c,d){if(null===b||null===a.Te)return null;for(var e=a.Te.iterator;e.next();){var f=e.value;if(f.Js===a&&f.nv===b&&f.my===c&&f.ny===d||f.Js===b&&f.nv===a&&f.my===d&&f.ny===c)return f}return null}t.jA=function(a,b,c){if(void 0===b||null===b)b="";if(void 0===c||null===c)c="";a=Ho(this,a,b,c);null!==a&&a.cm()};
t.nk=function(a,b,c,d,e,f,g){a===ie&&"elements"===b?this.nc=null:a===pe&&"elements"===b&&(this.nc=null);V.prototype.nk.call(this,a,b,c,d,e,f,g)};t.sd=function(a){for(var b=this.linksConnected;b.next();){var c=b.value;void 0!==a&&a.contains(c)||(Io(c.fromPort),Io(c.toPort),c.Va())}};function fl(a,b){for(a=a.linksConnected;a.next();){var c=a.value;if(c.fromPort===b||c.toPort===b)Io(c.fromPort),Io(c.toPort),c.Va()}}
function Io(a){if(null!==a){var b=a.Qo;null!==b&&b.cm();a=a.part;b=a.containingGroup;null===b||a.isVisible()||Io(b.port)}}t.Ri=function(){return!0};W.prototype.getAvoidableRect=function(a){a.set(this.actualBounds);a.Lp(this.Ak);return a};W.prototype.findVisibleNode=function(){for(var a=this;null!==a&&!a.isVisible();)a=a.containingGroup;return a};
W.prototype.isVisible=function(){if(!V.prototype.isVisible.call(this))return!1;var a=!0,b=ri,c=this.diagram;if(null!==c){if(c.animationManager.Ls(this))return!0;a=c.isTreePathToChildren;b=c.treeCollapsePolicy}if(b===ri){if(a=this.qg(),null!==a&&!a.isTreeExpanded)return!1}else if(b===wk){if(a=a?this.Ou():this.Pu(),0<a.count&&a.all(function(a){return!a.isTreeExpanded}))return!1}else if(b===xk&&(a=a?this.Ou():this.Pu(),0<a.count&&a.any(function(a){return!a.isTreeExpanded})))return!1;a=this.labeledLink;
return null!==a?a.isVisible():!0};W.prototype.Ob=function(a){V.prototype.Ob.call(this,a);for(var b=this.linksConnected;b.next();){var c=b.value;if(a&&null!==this.containingGroup){var d=c.$p(this);null===d||d.Jd(this.containingGroup)||c.Va()}c.Ob(a)}};W.prototype.Mx=function(){var a=new G,b=new G;Jo(this,this,a,b);return b.iterator};
function Jo(a,b,c,d){if(null!==b&&!c.has(b)){c.add(b);var e=!0,f=a.diagram;null!==f&&(e=f.isTreePathToChildren);b.linksConnected.each(function(f){f.isTreeLink?(e?f.fromNode===b:f.toNode===b)&&Jo(a,e?f.toNode:f.fromNode,c,d):d.add(f)})}}W.prototype.findLinksConnected=function(a){void 0===a&&(a=null);if(null===a)return this.ab.iterator;var b=new bb(this.ab),c=this;b.predicate=function(b){return b.fromNode===c&&b.fromPortId===a||b.toNode===c&&b.toPortId===a};return b};t=W.prototype;
t.Vp=function(a){void 0===a&&(a=null);var b=new bb(this.ab),c=this;b.predicate=function(b){return b.fromNode!==c?!1:null===a?!0:b.fromPortId===a};return b};t.Gd=function(a){void 0===a&&(a=null);var b=new bb(this.ab),c=this;b.predicate=function(b){return b.toNode!==c?!1:null===a?!0:b.toPortId===a};return b};
t.Nu=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.ab.iterator;d.next();){var e=d.value;if(e.fromNode===this){if(null===a||e.fromPortId===a)e=e.toNode,null!==b?b.add(e):null!==c&&c!==e?(b=new G,b.add(c),b.add(e)):c=e}else e.toNode!==this||null!==a&&e.toPortId!==a||(e=e.fromNode,null!==b?b.add(e):null!==c&&c!==e?(b=new G,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new ab(c):$a};
t.Pu=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.ab.iterator;d.next();){var e=d.value;e.fromNode!==this||null!==a&&e.fromPortId!==a||(e=e.toNode,null!==b?b.add(e):null!==c&&c!==e?(b=new G,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new ab(c):$a};
t.Ou=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.ab.iterator;d.next();){var e=d.value;e.toNode!==this||null!==a&&e.toPortId!==a||(e=e.fromNode,null!==b?b.add(e):null!==c&&c!==e?(b=new G,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new ab(c):$a};
t.Iz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new bb(this.ab),e=this;d.predicate=function(d){return(d.fromNode!==e||d.toNode!==a||null!==b&&d.fromPortId!==b||null!==c&&d.toPortId!==c)&&(d.fromNode!==a||d.toNode!==e||null!==c&&d.fromPortId!==c||null!==b&&d.toPortId!==b)?!1:!0};return d};
t.Jz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new bb(this.ab),e=this;d.predicate=function(d){return d.fromNode!==e||d.toNode!==a||null!==b&&d.fromPortId!==b||null!==c&&d.toPortId!==c?!1:!0};return d};
function Ko(a,b,c){Io(c);var d=a.ab.contains(b);d||a.ab.add(b);if(!d||b.fromNode===b.toNode){var e=a.linkConnected;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.Z,g.Z=!0);e(a,b,c);null!==g&&(g.Z=f)}}!d&&b.isTreeLink&&(c=b.fromNode,b=b.toNode,null!==c&&null!==b&&c!==b&&(d=!0,a=a.diagram,null!==a&&(d=a.isTreePathToChildren),e=d?b:c,f=d?c:b,e.vh||(e.vh=f),!f.isTreeLeaf||null!==a&&a.undoManager.isUndoingRedoing||(d?c===f&&(f.isTreeLeaf=!1):b===f&&(f.isTreeLeaf=!1))))}
function Lo(a,b,c){Io(c);var d=a.ab.remove(b),e=null;if(d||b.toNode===b.fromNode){var f=a.linkDisconnected;e=a.diagram;if(null!==f){var g=!0;null!==e&&(g=e.Z,e.Z=!0);f(a,b,c);null!==e&&(e.Z=g)}}d&&b.isTreeLink&&(c=!0,null!==e&&(c=e.isTreePathToChildren),a=c?b.toNode:b.fromNode,b=c?b.fromNode:b.toNode,null!==a&&(a.vh=!1),null===b||b.isTreeLeaf||(0===b.ab.count?(b.vh=null,null!==e&&e.undoManager.isUndoingRedoing||(b.isTreeLeaf=!0)):vk(b)))}
function vk(a){a.vh=!1;if(0!==a.ab.count){var b=!0,c=a.diagram;if(null===c||!c.undoManager.isUndoingRedoing){null!==c&&(b=c.isTreePathToChildren);for(c=a.ab.iterator;c.next();){var d=c.value;if(d.isTreeLink)if(b){if(d.fromNode===a){a.isTreeLeaf=!1;return}}else if(d.toNode===a){a.isTreeLeaf=!1;return}}a.isTreeLeaf=!0}}}W.prototype.updateRelationshipsFromData=function(){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)};t=W.prototype;
t.bq=function(a){V.prototype.bq.call(this,a);a||(vk(this),a=this.gl,null!==a&&Mo(a,this))};t.cq=function(a){V.prototype.cq.call(this,a);a||(a=this.gl,null!==a&&null!==a.od&&(a.od.remove(this),a.s()))};
t.Uj=function(){if(0<this.ab.count){var a=this.diagram;if(null!==a)for(var b=null!==a.commandHandler?a.commandHandler.deletesConnectedLinks:!0,c=this.ab.copy().iterator;c.next();){var d=c.value;b?a.remove(d):(d.fromNode===this&&(d.fromNode=null),d.toNode===this&&(d.toNode=null))}}this.labeledLink=null;V.prototype.Uj.call(this)};t.rs=function(a){if(null===this.nc){if(""===a&&!1===this.Je)return this;No(this)}var b=this.nc.H(a);return null!==b||""!==a&&(b=this.nc.H(""),null!==b)?b:this};
function No(a){null===a.nc?a.nc=new I:a.nc.clear();a.Cm(a,function(a,c){Jl(a,c)});0===a.nc.count&&a.nc.add("",a)}function Jl(a,b){var c=b.portId;null!==c&&null!==a.nc&&a.nc.add(c,b)}function Il(a,b,c){var d=b.portId;if(null!==d&&(null!==a.nc&&a.nc.remove(d),b=a.diagram,null!==b&&c)){c=null;for(a=a.findLinksConnected(d);a.next();)d=a.value,null===c&&(c=Ga()),c.push(d);if(null!==c){for(a=0;a<c.length;a++)b.remove(c[a]);Ja(c)}}}
t.lA=function(a){if(null===a||a===this)return!1;var b=!0,c=this.diagram;null!==c&&(b=c.isTreePathToChildren);c=this;if(b)for(;c!==a;){b=null;for(var d=c.ab.iterator;d.next();){var e=d.value;if(e.isTreeLink&&(b=e.fromNode,b!==c&&b!==this))break}if(b===this||null===b||b===c)return!1;c=b}else for(;c!==a;){b=null;for(d=c.ab.iterator;d.next()&&(e=d.value,!e.isTreeLink||(b=e.toNode,b===c||b===this)););if(b===this||null===b||b===c)return!1;c=b}return!0};
t.Vz=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this;if(a)for(;;){a=null;for(var c=b.ab.iterator;c.next();){var d=c.value;if(d.isTreeLink&&(a=d.fromNode,a!==b&&a!==this))break}if(a===this)return this;if(null===a||a===b)return b;b=a}else for(;;){a=null;for(c=b.ab.iterator;c.next()&&(d=c.value,!d.isTreeLink||(a=d.toNode,a===b||a===this)););if(a===this)return this;if(null===a||a===b)return b;b=a}};
t.Fz=function(a){if(null===a)return null;if(this===a)return this;for(var b=this;null!==b;)xo(b,!0),b=b.qg();var c=null;for(b=a;null!==b;){if(0!==(b.F&1048576)){c=b;break}b=b.qg()}for(b=this;null!==b;)xo(b,!1),b=b.qg();return c};t.Ii=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this.ab.iterator;if(a)for(;b.next();){if(a=b.value,a.isTreeLink&&a.fromNode!==this)return a}else for(;b.next();)if(a=b.value,a.isTreeLink&&a.toNode!==this)return a;return null};
t.qg=function(){var a=this.vh;if(null===a)return null;if(a instanceof W)return a;var b=!0;a=this.diagram;null!==a&&(b=a.isTreePathToChildren);a=this.ab.iterator;if(b)for(;a.next();){if(b=a.value,b.isTreeLink&&(b=b.fromNode,b!==this))return this.vh=b}else for(;a.next();)if(b=a.value,b.isTreeLink&&(b=b.toNode,b!==this))return this.vh=b;return this.vh=null};t.Tz=function(){function a(b,d){d.add(b);var c=b.Ii();null!==c&&(d.add(c),b=b.qg(),null!==b&&a(b,d))}var b=new G;a(this,b);return b};
t.Sz=function(){return Oo(this,this)};function Oo(a,b){b=b.qg();return null===b?0:1+Oo(a,b)}t.Xp=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=new bb(this.ab);var c=this;b.predicate=a?function(a){return a.isTreeLink&&a.fromNode===c?!0:!1}:function(a){return a.isTreeLink&&a.toNode===c?!0:!1};return b};
t.Ru=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);var c=b=null,d=this.ab.iterator;if(a)for(;d.next();)a=d.value,a.isTreeLink&&a.fromNode===this&&(a=a.toNode,null!==b?b.add(a):null!==c&&c!==a?(b=new F,b.add(c),b.add(a)):c=a);else for(;d.next();)a=d.value,a.isTreeLink&&a.toNode===this&&(a=a.fromNode,null!==b?b.add(a):null!==c&&c!==a?(b=new F,b.add(c),b.add(a)):c=a);return null!==b?b.iterator:null!==c?new ab(c):$a};
t.Uz=function(a){void 0===a&&(a=Infinity);var b=new G;Lk(b,this,!1,a,!0);return b};W.prototype.collapseTree=function(a){void 0===a&&(a=1);1>a&&(a=1);var b=this.diagram;if(null!==b&&!b.Ke){b.Ke=!0;var c=new G;c.add(this);Po(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===ri);b.Ke=!1}};function Po(a,b,c,d,e,f,g){if(1<d)for(var h=c?a.Vp():a.Gd();h.next();){var k=h.value;k.isTreeLink&&(k=k.$p(a),null===k||k===a||b.contains(k)||(b.add(k),Po(k,b,c,d-1,e,f,g)))}else Qo(a,b,c,e,f,g)}
function Qo(a,b,c,d,e,f){for(var g=e===a?!0:a.isTreeExpanded,h=c?a.Vp():a.Gd();h.next();){var k=h.value;if(k.isTreeLink&&(k=k.$p(a),null!==k&&k!==a)){var l=b.contains(k);l||b.add(k);g&&(f&&d.Kj(k,e),k.Gh(),k.Ob(!1));k.isTreeExpanded&&(k.wasTreeExpanded=k.isTreeExpanded,l||Qo(k,b,c,d,e,f))}}a.isTreeExpanded=!1}
W.prototype.expandTree=function(a){void 0===a&&(a=2);2>a&&(a=2);var b=this.diagram;if(null!==b&&!b.Ke){b.Ke=!0;var c=new G;c.add(this);Ro(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===ri);b.Ke=!1}};
function Ro(a,b,c,d,e,f,g){for(var h=f===a?!1:a.isTreeExpanded,k=c?a.Vp():a.Gd();k.next();){var l=k.value;l.isTreeLink&&(h||l.ud||l.Va(),l=l.$p(a),null!==l&&l!==a&&!b.contains(l)&&(b.add(l),h||(l.Ob(!0),l.Gh(),g&&e.Mj(l,f)),2<d||l.wasTreeExpanded))&&(l.wasTreeExpanded=!1,Ro(l,b,c,d-1,e,f,g))}a.isTreeExpanded=!0}
na.Object.defineProperties(W.prototype,{portSpreading:{get:function(){return this.Ro},set:function(a){var b=this.Ro;b!==a&&(this.Ro=a,this.g("portSpreading",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.sd())}},avoidable:{get:function(){return 0!==(this.R&8)},set:function(a){var b=0!==(this.R&8);if(b!==a){this.R^=8;var c=this.diagram;null!==c&&pk(c,this);this.g("avoidable",b,a)}}},avoidableMargin:{
get:function(){return this.Ak},set:function(a){"number"===typeof a&&(a=new kc(a));var b=this.Ak;if(!b.A(a)){this.Ak=a=a.I();var c=this.diagram;null!==c&&pk(c,this);this.g("avoidableMargin",b,a)}}},linksConnected:{get:function(){return this.ab.iterator}},linkConnected:{get:function(){return this.ho},set:function(a){var b=this.ho;b!==a&&(this.ho=a,this.g("linkConnected",b,a))}},linkDisconnected:{get:function(){return this.io},
set:function(a){var b=this.io;b!==a&&(this.io=a,this.g("linkDisconnected",b,a))}},linkValidation:{get:function(){return this.ii},set:function(a){var b=this.ii;b!==a&&(this.ii=a,this.g("linkValidation",b,a))}},isLinkLabel:{get:function(){return null!==this.gl}},labeledLink:{get:function(){return this.gl},set:function(a){var b=this.gl;if(b!==a){var c=this.diagram,d=this.data;if(null!==b){null!==b.od&&(b.od.remove(this),
b.s());if(null!==c&&null!==d&&!c.undoManager.isUndoingRedoing){var e=b.data,f=c.model;if(null!==e&&f.Pi()){var g=f.pa(d);void 0!==g&&f.oy(e,g)}}this.containingGroup=null}this.gl=a;null!==a&&(Mo(a,this),null===c||null===d||c.undoManager.isUndoingRedoing||(e=a.data,c=c.model,null!==e&&c.Pi()&&(d=c.pa(d),void 0!==d&&c.tu(e,d))),this.containingGroup=a.containingGroup);tl(this);this.g("labeledLink",b,a)}}},port:{get:function(){return this.rs("")}},ports:{
get:function(){null===this.nc&&No(this);return this.nc.iteratorValues}},isTreeExpanded:{get:function(){return 0!==(this.R&1)},set:function(a){var b=0!==(this.R&1);if(b!==a){this.R^=1;var c=this.diagram;this.g("isTreeExpanded",b,a);b=this.treeExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.Z,c.Z=!0);b(this);null!==c&&(c.Z=d)}null!==c&&c.undoManager.isUndoingRedoing?this.Ob(a):a?this.expandTree():this.collapseTree()}}},wasTreeExpanded:{
get:function(){return 0!==(this.R&2)},set:function(a){var b=0!==(this.R&2);b!==a&&(this.R^=2,this.g("wasTreeExpanded",b,a))}},treeExpandedChanged:{get:function(){return this.Dp},set:function(a){var b=this.Dp;b!==a&&(this.Dp=a,this.g("treeExpandedChanged",b,a))}},isTreeLeaf:{get:function(){return 0!==(this.R&4)},set:function(a){var b=0!==(this.R&4);b!==a&&(this.R^=4,this.g("isTreeLeaf",b,a))}}});W.prototype.expandTree=W.prototype.expandTree;
W.prototype.collapseTree=W.prototype.collapseTree;W.prototype.findTreeParts=W.prototype.Uz;W.prototype.findTreeChildrenNodes=W.prototype.Ru;W.prototype.findTreeChildrenLinks=W.prototype.Xp;W.prototype.findTreeLevel=W.prototype.Sz;W.prototype.findTreeParentChain=W.prototype.Tz;W.prototype.findTreeParentNode=W.prototype.qg;W.prototype.findTreeParentLink=W.prototype.Ii;W.prototype.findCommonTreeParent=W.prototype.Fz;W.prototype.findTreeRoot=W.prototype.Vz;W.prototype.isInTreeOf=W.prototype.lA;
W.prototype.findPort=W.prototype.rs;W.prototype.findLinksTo=W.prototype.Jz;W.prototype.findLinksBetween=W.prototype.Iz;W.prototype.findNodesInto=W.prototype.Ou;W.prototype.findNodesOutOf=W.prototype.Pu;W.prototype.findNodesConnected=W.prototype.Nu;W.prototype.findLinksInto=W.prototype.Gd;W.prototype.findLinksOutOf=W.prototype.Vp;W.prototype.findExternalTreeLinksConnected=W.prototype.Mx;W.prototype.invalidateConnectedLinks=W.prototype.sd;W.prototype.invalidateLinkBundle=W.prototype.jA;
var So=new D(W,"SpreadingNone",10),Fo=new D(W,"SpreadingEvenly",11),To=new D(W,"SpreadingPacked",12);W.className="Node";W.SpreadingNone=So;W.SpreadingEvenly=Fo;W.SpreadingPacked=To;function U(a,b){void 0===a||a instanceof El||"string"===typeof a?W.call(this,a):(W.call(this),a&&(b=a));this.R|=4608;this.so=new G;this.pl=new G;this.Sa=this.wp=this.ki=this.to=this.ro=this.$a=null;this.Ec=new mi;this.Ec.group=this;this.Zq=null;b&&Object.assign(this,b)}ma(U,W);
U.prototype.cloneProtected=function(a){W.prototype.cloneProtected.call(this,a);this.R=this.R&-32769;null!==this.$a&&(a.$a=this.$a.copy());a.ro=this.ro;a.to=this.to;a.ki=this.ki;a.wp=this.wp;var b=a.Yl(function(a){return a instanceof mg});b instanceof mg?a.Sa=b:a.Sa=null;null!==this.Ec?(a.Ec=this.Ec.copy(),a.Ec.group=a):(null!==a.Ec&&(a.Ec.group=null),a.Ec=null)};t=U.prototype;
t.wf=function(a){W.prototype.wf.call(this,a);var b=a.Yj();for(a=a.memberParts;a.next();){var c=a.value;c.s();c.B(8);c.Oj();if(c instanceof W)c.sd(b);else if(c instanceof T)for(c=c.labelNodes;c.next();)c.value.sd(b)}};
t.nk=function(a,b,c,d,e,f,g){if(a===ie&&"elements"===b)if(e instanceof mg)null===this.Sa?this.Sa=e:this.Sa!==e&&C("Cannot insert a second Placeholder into the visual tree of a Group.");else{if(e instanceof X){var h=e.Yl(function(a){return a instanceof mg});h instanceof mg&&(null===this.Sa?this.Sa=h:this.Sa!==h&&C("Cannot insert a second Placeholder into the visual tree of a Group."))}}else a===pe&&"elements"===b&&null!==this.Sa&&(d===this.Sa?this.Sa=null:d instanceof X&&this.Sa.rg(d)&&(this.Sa=null));
W.prototype.nk.call(this,a,b,c,d,e,f,g)};t.hm=function(a,b){W.prototype.hm.call(this,a,b);this.isClipping&&this.type!==X.Spot&&this.isSubGraphExpanded&&(a=this.resizeObject,a instanceof X&&(a=a.pb()),null===this.$a&&(this.$a=new M),a.Li(this.$a),a instanceof xf&&this.$a.Kc(-a.strokeWidth,-a.strokeWidth))};t.zh=function(a,b,c,d){this.cf=this.Sa;W.prototype.zh.call(this,a,b,c,d)};
t.Ta=function(){var a=this;a.isSubGraphExpanded&&this.memberParts.each(function(b){!a.computesBoundsIncludingLinks&&b instanceof T||b.Ta()});W.prototype.Ta.call(this)};t.Ri=function(){if(!W.prototype.Ri.call(this))return!1;for(var a=this.memberParts;a.next();){var b=a.value;if(b instanceof W){if(b.isVisible()&&ij(b))return!1}else if(b instanceof T&&b.isVisible()&&ij(b)&&b.fromNode!==this&&b.toNode!==this)return!1}return!0};
function yo(a,b){if(a.so.add(b)){b instanceof U&&a.pl.add(b);var c=a.memberAdded;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.Z,e.Z=!0);c(a,b);null!==e&&(e.Z=d)}a.isVisible()&&a.isSubGraphExpanded||b.Ob(!1)}b instanceof T&&!a.computesBoundsIncludingLinks||(b=a.Sa,null===b&&(b=a),b.s())}
function zo(a,b){if(a.so.remove(b)){b instanceof U&&a.pl.remove(b);var c=a.memberRemoved;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.Z,e.Z=!0);c(a,b);null!==e&&(e.Z=d)}a.isVisible()&&a.isSubGraphExpanded||b.Ob(!0)}b instanceof T&&!a.computesBoundsIncludingLinks||(b=a.Sa,null===b&&(b=a),b.s())}t.Uj=function(){if(0<this.so.count){var a=this.diagram;if(null!==a)for(var b=this.so.copy().iterator;b.next();)a.remove(b.value)}W.prototype.Uj.call(this)};
U.prototype.canAddMembers=function(a){var b=this.diagram;if(null===b)return!1;b=b.commandHandler;for(a=Nk(a).iterator;a.next();)if(!b.isValidMember(this,a.value))return!1;return!0};U.prototype.addMembers=function(a,b){var c=this.diagram;if(null===c)return!1;c=c.commandHandler;var d=!0;for(a=Nk(a).iterator;a.next();){var e=a.value;!b||c.isValidMember(this,e)?e.containingGroup=this:d=!1}return d};
U.prototype.canUngroup=function(){if(!this.ungroupable)return!1;var a=this.layer;if(null!==a&&!a.allowUngroup)return!1;a=a.diagram;return null===a||a.allowUngroup?!0:!1};t=U.prototype;
t.sd=function(a){var b=0!==(this.R&65536);W.prototype.sd.call(this,a);if(!b)for(0!==(this.R&65536)!==!0&&(this.R=this.R^65536),b=this.Mu();b.next();){var c=b.value;if(void 0===a||!a.contains(c)){var d=c.fromNode;null!==d&&d!==this&&d.Jd(this)&&!d.isVisible()?(Io(c.fromPort),Io(c.toPort),c.Va()):(d=c.toNode,null!==d&&d!==this&&d.Jd(this)&&!d.isVisible()&&(Io(c.fromPort),Io(c.toPort),c.Va()))}}};
t.Mu=function(){var a=null!==this.diagram&&this.diagram.mx;if(a&&null!==this.Zq)return this.Zq.iterator;var b=this.Yj();b.add(this);for(var c=new G,d=b.iterator;d.next();){var e=d.value;if(e instanceof W)for(e=e.linksConnected;e.next();){var f=e.value;b.contains(f)||c.add(f)}}a&&(this.Zq=c);return c.iterator};
t.Hz=function(){var a=this.Yj();a.add(this);for(var b=new G,c=a.iterator;c.next();){var d=c.value;if(d instanceof W)for(d=d.linksConnected;d.next();){var e=d.value,f=e.fromNode;null===f||a.contains(f)&&f!==this||b.add(f);e=e.toNode;null===e||a.contains(e)&&e!==this||b.add(e)}}return b.iterator};t.Gz=function(){function a(b,d){null!==b&&(d.add(b),a(b.containingGroup,d))}var b=new G;a(this,b);return b};t.Yj=function(){var a=new G;Lk(a,this,!0,0,!0);a.remove(this);return a};
t.Ob=function(a){W.prototype.Ob.call(this,a);for(var b=this.memberParts;b.next();)b.value.Ob(a)};U.prototype.collapseSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Ke){a.Ke=!0;var b=this.Yj();Uo(this,b,a,this);a.Ke=!1}};
function Uo(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Ob(!1);f instanceof U&&f.isSubGraphExpanded&&(f.wasSubGraphExpanded=f.isSubGraphExpanded,Uo(f,b,c,d));if(f instanceof W)f.sd(b),c.Kj(f,d);else if(f instanceof T)for(f=f.labelNodes;f.next();)f.value.sd(b)}a.isSubGraphExpanded=!1}U.prototype.expandSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Ke){a.Ke=!0;var b=this.Yj();Vo(this,b,a,this);a.Ke=!1}};
function Vo(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Ob(!0);f instanceof U&&f.wasSubGraphExpanded&&(f.wasSubGraphExpanded=!1,Vo(f,b,c,d));if(f instanceof W)f.sd(b),c.Mj(f,d);else if(f instanceof T)for(f=f.labelNodes;f.next();)f.value.sd(b)}a.isSubGraphExpanded=!0}
U.prototype.move=function(a,b){void 0===b&&(b=!1);var c=b?this.location:this.position,d=c.x;c=c.y;var e=a.x,f=a.y;if(!(d===e||isNaN(d)&&isNaN(e))||!(c===f||isNaN(c)&&isNaN(f))){d=e-(isNaN(d)?0:d);c=f-(isNaN(c)?0:c);f=J.alloc();W.prototype.move.call(this,a,b);a=new G;for(b=this.Yj().iterator;b.next();)if(e=b.value,e instanceof T&&(e.suspendsRouting&&a.add(e),e.ud||e.fromNode!==this&&e.toNode!==this))e.suspendsRouting=!0;for(b.reset();b.next();)if(e=b.value,!(e.Hh()||e instanceof W&&e.isLinkLabel)){var g=
e.position,h=e.location;g.u()?(f.x=g.x+d,f.y=g.y+c,e.position=f):h.u()&&(f.x=h.x+d,f.y=h.y+c,e.location=f)}for(b.reset();b.next();)if(e=b.value,e instanceof T&&(e.suspendsRouting=a.contains(e),e.ud||e.fromNode!==this&&e.toNode!==this))g=e.position,f.x=g.x+d,f.y=g.y+c,f.u()?e.move(f):e.Va(),Fj(e)&&e.Va();J.free(f)}};
na.Object.defineProperties(U.prototype,{placeholder:{get:function(){return this.Sa}},computesBoundsAfterDrag:{get:function(){return 0!==(this.R&2048)},set:function(a){var b=0!==(this.R&2048);b!==a&&(this.R^=2048,this.g("computesBoundsAfterDrag",b,a))}},computesBoundsIncludingLinks:{get:function(){return 0!==(this.R&4096)},set:function(a){var b=0!==(this.R&4096);b!==a&&(this.R^=4096,this.g("computesBoundsIncludingLinks",
b,a))}},computesBoundsIncludingLocation:{get:function(){return 0!==(this.R&8192)},set:function(a){var b=0!==(this.R&8192);b!==a&&(this.R^=8192,this.g("computesBoundsIncludingLocation",b,a))}},handlesDragDropForMembers:{get:function(){return 0!==(this.R&16384)},set:function(a){var b=0!==(this.R&16384);b!==a&&(this.R^=16384,this.g("handlesDragDropForMembers",b,a))}},memberParts:{get:function(){return this.so.iterator}},
layout:{get:function(){return this.Ec},set:function(a){var b=this.Ec;if(b!==a){null!==b&&(b.diagram=null,b.group=null);this.Ec=a;var c=this.diagram;null!==a&&(a.diagram=c,a.group=this);null!==c&&(c.Oh=!0);this.g("layout",b,a);null!==c&&c.Fb()}}},memberAdded:{get:function(){return this.ro},set:function(a){var b=this.ro;b!==a&&(this.ro=a,this.g("memberAdded",b,a))}},memberRemoved:{get:function(){return this.to},
set:function(a){var b=this.to;b!==a&&(this.to=a,this.g("memberRemoved",b,a))}},memberValidation:{get:function(){return this.ki},set:function(a){var b=this.ki;b!==a&&(this.ki=a,this.g("memberValidation",b,a))}},ungroupable:{get:function(){return 0!==(this.R&256)},set:function(a){var b=0!==(this.R&256);b!==a&&(this.R^=256,this.g("ungroupable",b,a))}},isSubGraphExpanded:{get:function(){return 0!==(this.R&512)},
set:function(a){var b=0!==(this.R&512);if(b!==a){this.R^=512;var c=this.diagram;this.g("isSubGraphExpanded",b,a);b=this.subGraphExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.Z,c.Z=!0);b(this);null!==c&&(c.Z=d)}null!==c&&c.undoManager.isUndoingRedoing?(null!==this.Sa&&this.Sa.s(),this.memberParts.each(function(a){a.updateAdornments()})):a?this.expandSubGraph():this.collapseSubGraph()}}},wasSubGraphExpanded:{get:function(){return 0!==(this.R&1024)},set:function(a){var b=
0!==(this.R&1024);b!==a&&(this.R^=1024,this.g("wasSubGraphExpanded",b,a))}},subGraphExpandedChanged:{get:function(){return this.wp},set:function(a){var b=this.wp;b!==a&&(this.wp=a,this.g("subGraphExpandedChanged",b,a))}},Jh:{get:function(){return 0!==(this.R&32768)},set:function(a){0!==(this.R&32768)!==a&&(this.R^=32768)}}});U.prototype.expandSubGraph=U.prototype.expandSubGraph;U.prototype.collapseSubGraph=U.prototype.collapseSubGraph;
U.prototype.findSubGraphParts=U.prototype.Yj;U.prototype.findContainingGroupChain=U.prototype.Gz;U.prototype.findExternalNodesConnected=U.prototype.Hz;U.prototype.findExternalLinksConnected=U.prototype.Mu;U.prototype.ensureBounds=U.prototype.Ta;U.className="Group";function mg(a){Y.call(this);this.nb=oc;this.fp=new M(NaN,NaN,NaN,NaN);a&&Object.assign(this,a)}ma(mg,Y);mg.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.nb=this.nb.I();a.fp=this.fp.copy()};
mg.prototype.Bh=function(a){if(null===this.background&&null===this.areaBackground)return!1;var b=this.naturalBounds;return ac(0,0,b.width,b.height,a.x,a.y)};
mg.prototype.gm=function(){var a=this.part;null!==a&&(a instanceof U||a instanceof ye)||C("Placeholder is not inside a Group or Adornment.");if(a instanceof U){var b=this.computeBorder(this.fp),c=this.minSize,d=this.uc;Qb(d,(isFinite(c.width)?Math.max(c.width,b.width):b.width)||0,(isFinite(c.height)?Math.max(c.height,b.height):b.height)||0);this.xe(0,0,d.width,d.height);d=a.memberParts;for(c=!1;d.next();)if(d.value.isVisible()){c=!0;break}d=a.diagram;!c||null===d||d.animationManager.cv(a)||isNaN(b.x)||
isNaN(b.y)||(c=J.alloc(),c.Ti(b,a.locationSpot),c.A(a.location)||(a.location=c),J.free(c))}else{b=this.uc;c=this.nb;d=c.left+c.right;var e=c.top+c.bottom,f=a.adornedObject;a.angle=f.Ki();var g=0;f instanceof xf&&(g=f.strokeWidth);var h=f.Af(),k=f.naturalBounds,l=(k.width+g)*h;g=(k.height+g)*h;a.type!==X.Link&&(f=f.da("Selection"===a.category?tc:a.locationSpot,J.alloc()),a.location=f,J.free(f));isNaN(l)||isNaN(g)?(a=a.adornedObject,l=a.da(tc,J.alloc()),f=M.allocAt(l.x,l.y,0,0),f.Oe(a.da(Bc,l)),f.Oe(a.da(vc,
l)),f.Oe(a.da(zc,l)),Qb(b,f.width+d||0,f.height+e||0),this.xe(-c.left,-c.top,b.width,b.height),J.free(l),M.free(f)):(Qb(b,l+d||0,g+e||0),this.xe(-c.left,-c.top,b.width,b.height))}};mg.prototype.zh=function(a,b,c,d){this.actualBounds.h(a,b,c,d)};
mg.prototype.computeBorder=function(a){var b=this.part,c=b.diagram;if(null!==c&&b instanceof U&&!b.layer.isTemporary&&b.computesBoundsAfterDrag&&this.fp.u()){var d=c.toolManager.findTool("Dragging");if(d===c.currentTool&&(c=d.computeBorder(b,this.fp,a),null!==c))return c}c=M.alloc();d=this.computeMemberBounds(c);var e=this.nb;b instanceof U&&!b.isSubGraphExpanded?a.h(d.x-e.left,d.y-e.top,0,0):a.h(d.x-e.left,d.y-e.top,Math.max(d.width+e.left+e.right,0),Math.max(d.height+e.top+e.bottom,0));M.free(c);
b instanceof U&&b.computesBoundsIncludingLocation&&b.location.u()&&a.Oe(b.location);return a};
mg.prototype.computeMemberBounds=function(a){if(!(this.part instanceof U))return a.h(0,0,0,0),a;for(var b=this.part,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=b.memberParts;g.next();){var h=g.value;if(h.isVisible()){if(h instanceof T){if(!b.computesBoundsIncludingLinks)continue;if(hj(h))continue;if(h.fromNode===b||h.toNode===b)continue}h=h.actualBounds;h.left<c&&(c=h.left);h.top<d&&(d=h.top);h.right>e&&(e=h.right);h.bottom>f&&(f=h.bottom)}}isFinite(c)&&isFinite(d)?a.h(c,d,e-c,f-d):(b=b.location,
a.h(b.x,b.y,0,0));return a};na.Object.defineProperties(mg.prototype,{padding:{get:function(){return this.nb},set:function(a){"number"===typeof a&&(a=new kc(a));var b=this.nb;b.A(a)||(this.nb=a=a.I(),this.g("padding",b,a),this.s())}}});mg.className="Placeholder";
function T(a){V.call(this,X.Link);this.Ia=8;this.We=null;this.Xe="";this.pf=this.Cn=null;this.qf="";this.Cp=null;this.uk=Rf;this.fn=0;this.hn=Rf;this.jn=NaN;this.Cj=Wo;this.qp=.5;this.od=null;this.Cb=(new F).freeze();this.gf=this.dh=null;this.wl=new M;this.ma=new P;this.D=this.o=this.Mf=this.Qf=null;this.lu=new J;this.cr=this.jx=this.ix=null;this.Gt=NaN;this.P=null;this.j=[];a&&Object.assign(this,a)}ma(T,V);
T.prototype.cloneProtected=function(a){V.prototype.cloneProtected.call(this,a);a.Ia=this.Ia&-113;a.Xe=this.Xe;a.Cn=this.Cn;a.qf=this.qf;a.Cp=this.Cp;a.uk=this.uk;a.fn=this.fn;a.hn=this.hn;a.jn=this.jn;a.Cj=this.Cj;a.qp=this.qp;null!==this.P&&(a.P=this.P.copy())};t=T.prototype;t.wf=function(a){V.prototype.wf.call(this,a);this.Xe=a.Xe;this.qf=a.qf;a.dh=null;a.Va();a.Mf=this.Mf;var b=a.fromPort;null!==b&&Io(b);a=a.toPort;null!==a&&Io(a)};
t.gb=function(a){a.classType===T?2===(a.value&2)?this.routing=a:a===Uf||a===Qf||a===Pf?this.curve=a:a===Xo||a===Yo||a===Zo?this.adjusting=a:a!==Wo&&a!==Rf&&C("Unknown Link enum value for a Link property: "+a):V.prototype.gb.call(this,a)};t.Lc=function(){null===this.P&&(this.P=new Xk)};t.Ri=function(){var a=this.fromNode;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(ij(a)||jj(a))return!1}a=this.toNode;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),ij(a)||jj(a))?!1:!0};t.Jv=function(){return!1};
t.Us=function(){};t.Nc=function(){return!1};T.prototype.computeAngle=function(a,b,c){return T.computeAngle(b,c)};T.computeAngle=function(a,b){switch(a){default:case Rf:a=0;break;case Lm:a=b;break;case Em:a=b+90;break;case Gm:a=b-90;break;case $o:a=b+180;break;case Mm:a=L.iq(b);90<a&&270>a&&(a-=180);break;case Fm:a=L.iq(b+90);90<a&&270>a&&(a-=180);break;case Hm:a=L.iq(b-90);90<a&&270>a&&(a-=180);break;case Im:a=L.iq(b);if(45<a&&135>a||225<a&&315>a)return 0;90<a&&270>a&&(a-=180)}return L.iq(a)};
function Eo(a){var b=a.fromNode,c=a.toNode,d=null;null!==b?d=null!==c?b.Lx(c):b.containingGroup:null!==c?d=c.containingGroup:d=null;b=d;c=a.Rh;if(c!==b){null!==c&&zo(c,a);a.Rh=b;null!==b&&yo(b,a);var e=a.containingGroupChanged;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.Z,g.Z=!0);e(a,c,b);null!==g&&(g.Z=f)}!a.ud||a.ix!==c&&a.jx!==c||a.Va()}if(a.isLabeledLink)for(a=a.labelNodes;a.next();)a.value.containingGroup=d}t=T.prototype;
t.Gh=function(){var a=this.containingGroup;null!==a&&this.fromNode!==a&&this.toNode!==a&&a.computesBoundsIncludingLinks&&V.prototype.Gh.call(this)};t.$p=function(a){var b=this.fromNode;return a===b?this.toNode:b};t.$z=function(a){var b=this.fromPort;return a===b?this.toPort:b};function Mo(a,b){null===a.od&&(a.od=new G);a.od.add(b);a.s()}
t.bq=function(a){V.prototype.bq.call(this,a);ap(this)&&this.eq(this.actualBounds);if(!a){a=this.We;var b=null;null!==a&&(b=this.fromPort,Ko(a,this,b));var c=this.pf;if(null!==c){var d=this.toPort;c===a&&d===b||Ko(c,this,d)}bp(this)}};t.cq=function(a){V.prototype.cq.call(this,a);ap(this)&&this.eq(this.actualBounds);if(!a){a=this.We;var b=null;null!==a&&(b=this.fromPort,Lo(a,this,b));var c=this.pf;if(null!==c){var d=this.toPort;c===a&&d===b||Lo(c,this,d)}cp(this)}};
t.Uj=function(){this.ud=!0;if(null!==this.od){var a=this.diagram;if(null!==a)for(var b=this.od.copy().iterator;b.next();)a.remove(b.value)}null!==this.data&&(a=this.diagram,null!==a&&a.partManager.removeDataForLink(this))};T.prototype.updateRelationshipsFromData=function(){if(null!==this.data){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)}};
T.prototype.move=function(a,b){var c=b?this.location:this.position,d=c.x;isNaN(d)&&(d=0);var e=c.y;isNaN(e)&&(e=0);d=a.x-d;e=a.y-e;!0===b?V.prototype.move.call(this,a,!1):(a=J.allocAt(c.x+d,c.y+e),V.prototype.move.call(this,a,!1),J.free(a));gf(this,d,e);for(a=this.labelNodes;a.next();)b=a.value,c=b.position,b.moveTo(c.x+d,c.y+e)};
T.prototype.canRelinkFrom=function(){if(!this.relinkableFrom)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};T.prototype.canRelinkTo=function(){if(!this.relinkableTo)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};
T.prototype.computeMidPoint=function(a){var b=this.pointsCount;if(0===b)return a.assign(ub),a;if(1===b)return a.assign(this.i(0)),a;if(2===b){var c=this.i(0),d=this.i(1);a.h((c.x+d.x)/2,(c.y+d.y)/2);return a}if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===Uf))return this.ma.Tu(.5,a),a.add(this.i(0)),c=this.ma.figures.first(),a.offset(-c.startX,-c.startY),a;if(this.computeCurve()===Uf){if(3===b)return this.i(1);d=(b-1)/3|0;c=3*(d/2|0);if(1===d%2){d=this.i(c);var e=this.i(c+1),
f=this.i(c+2);c=this.i(c+3);L.iz(d.x,d.y,e.x,e.y,f.x,f.y,c.x,c.y,a)}else a.assign(this.i(c));return a}var g=this.flattenedLengths;c=this.flattenedTotalLength;for(e=f=d=0;d<c/2&&f<b;){e=g[f];if(d+e>c/2)break;d+=e;f++}b=this.i(f);f=this.i(f+1);1>Math.abs(b.x-f.x)?b.y>f.y?a.h(b.x,b.y-(c/2-d)):a.h(b.x,b.y+(c/2-d)):1>Math.abs(b.y-f.y)?b.x>f.x?a.h(b.x-(c/2-d),b.y):a.h(b.x+(c/2-d),b.y):(c=(c/2-d)/e,a.h(b.x+c*(f.x-b.x),b.y+c*(f.y-b.y)));return a};
T.prototype.computeMidAngle=function(){var a=this.pointsCount;if(2>a)return NaN;if(2===a)return this.i(0).Pa(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===Uf))return this.ma.Rx(.5);if(this.computeCurve()===Uf&&4<=a){var b=(a-1)/3|0,c=3*(b/2|0);if(1===b%2){c=Math.floor(c);a=this.i(c);b=this.i(c+1);var d=this.i(c+2);c=this.i(c+3);return L.hz(a.x,a.y,b.x,b.y,d.x,d.y,c.x,c.y)}if(0<c&&c+1<a)return this.i(c-1).Pa(this.i(c+1))}b=this.flattenedLengths;d=this.flattenedTotalLength;
var e=0;c=0;for(var f;e<d/2&&c<a;){f=b[c];if(e+f>d/2)break;e+=f;c++}b=this.i(c);d=this.i(c+1);if(1>Math.abs(b.x-d.x)&&1>Math.abs(b.y-d.y)){if(0<c&&c+2<a)return this.i(c-1).Pa(this.i(c+2))}else{if(1>Math.abs(b.x-d.x))return b.y>d.y?270:90;if(1>Math.abs(b.y-d.y))return b.x>d.x?180:0}return b.Pa(d)};t=T.prototype;t.i=function(a){return this.Cb.m[a]};t.Qc=function(a,b){this.Cb.Pc(a,b)};t.M=function(a,b,c){this.Cb.Pc(a,new J(b,c))};t.iA=function(a,b){this.Cb.wb(a,b)};
t.l=function(a,b,c){this.Cb.wb(a,new J(b,c))};t.ee=function(a){this.Cb.add(a)};t.tf=function(a,b){this.Cb.add(new J(a,b))};t.Av=function(a){this.Cb.eb(a)};t.Pj=function(){this.Cb.clear()};
function gf(a,b,c){if(0!==b||0!==c)if(0===a.pointsCount)a.defaultFromPoint&&a.defaultFromPoint.offset(b,c),a.defaultToPoint&&a.defaultToPoint.offset(b,c);else{for(var d=a.ud,e=new F,f=a.Cb.iterator;f.next();){var g=f.value;e.add((new J(g.x+b,g.y+c)).freeze())}e.freeze();f=a.Cb;a.Cb=e;g=a.diagram;isNaN(b)||isNaN(c)||null!==g&&g.animationManager.tb?a.s():(a.Wf.h(a.Wf.x+b,a.Wf.y+c),a.ja.h(a.ja.x+b,a.ja.y+c),tl(a));d?dp(a):(a.defaultFromPoint&&(a.defaultFromPoint=a.i(0)),a.defaultToPoint&&(a.defaultToPoint=
a.i(a.pointsCount-1)));null!==g&&g.animationManager.tb&&(b=g.animationManager,a.gf=e,b.yl.add(a));a.g("points",f,e)}}t.Lh=function(){null===this.dh&&(this.dh=this.Cb,this.Cb=this.Cb.copy())};
t.vf=function(){if(null!==this.dh){for(var a=this.dh,b=this.Cb,c=Infinity,d=Infinity,e=a.m,f=e.length,g=0;g<f;g++){var h=e[g];c=Math.min(h.x,c);d=Math.min(h.y,d)}h=g=Infinity;for(var k=b.m,l=k.length,m=0;m<l;m++){var n=k[m];g=Math.min(n.x,g);h=Math.min(n.y,h);n.freeze()}b.freeze();if(l===f)for(f=0;f<l;f++){if(m=e[f],n=k[f],m.x-c!==n.x-g||m.y-d!==n.y-h){this.fc(!0);break}}else this.fc(!0);this.dh=null;c=this.diagram;null!==c&&c.animationManager.tb&&(c=c.animationManager,this.gf=b,c.yl.add(this));dp(this);
this.g("points",a,b)}};t.Cv=function(){null!==this.dh&&(this.Cb=this.dh,this.dh=null)};function dp(a){0===a.Cb.count?a.ud=!1:(a.ud=!0,a.cr=null,a.Gt=NaN,a.defaultFromPoint=a.i(0),a.defaultToPoint=a.i(a.pointsCount-1),ep(a,!1))}
t.Va=function(){if(!this.suspendsRouting){var a=this.diagram;if(a){if(a.Gs.contains(this)||a.undoManager.isUndoingRedoing)return;a=a.animationManager;if(a.isTicking&&!a.isAnimating)return;null!==this.gf&&!a.isTicking&&a.isAnimating&&(this.gf=null)}a=this.path;null!==a&&(this.ud=!1,this.s(),a.s())}};
t.ug=function(){if(!this.ud&&!this.computingPoints){var a=!0;try{this.computingPoints=!0,this.Lh(),a=this.computePoints()}catch(b){this.computingPoints=!1,this.Cv()}finally{this.computingPoints=!1,a?this.vf():this.Cv()}}};
T.prototype.computePoints=function(){if(null===this.diagram)return!1;var a=this.fromNode,b=null;null===a?(fp||(fp=new W,fp.desiredSize=Gb,fp.Ta()),this.defaultFromPoint&&(fp.location=this.defaultFromPoint,fp.Ta(),b=a=fp)):b=this.fromPort;if(null!==b&&!a.isVisible()){var c=a.findVisibleNode();null!==c&&c!==a?(a=c,b=c.port):a=c}this.ix=a;if(null===a||!a.location.u())return!1;for(;!(null===b||b.actualBounds.u()&&b.Ff());)b=b.panel;if(null===b)return!1;var d=this.toNode,e=null;null===d?(gp||(gp=new W,
gp.desiredSize=Gb,gp.Ta()),this.defaultToPoint&&(gp.location=this.defaultToPoint,gp.Ta(),e=d=gp)):e=this.toPort;null===e||d.isVisible()||(c=d.findVisibleNode(),null!==c&&c!==d?(d=c,e=c.port):d=c);this.jx=d;if(null===d||!d.location.u())return!1;for(;!(null===e||e.actualBounds.u()&&e.Ff());)e=e.panel;if(null===e)return!1;var f=this.pointsCount,g=this.computeSpot(!0,b);c=this.computeSpot(!1,e);var h=hp(g),k=hp(c),l=b===e&&null!==b,m=this.isOrthogonal,n=this.curve===Uf;this.Qf=l&&!m?n=!0:!1;var p=this.computeAdjusting()===
Rf||l;if(!m&&!l&&h&&k){if(h=!1,!p&&3<=f&&(p=this.getLinkPoint(a,b,g,!0,!1,d,e),k=this.getLinkPoint(d,e,c,!1,!1,a,b),h=this.adjustPoints(0,p,f-1,k))&&(p=this.getLinkPoint(a,b,g,!0,!1,d,e),k=this.getLinkPoint(d,e,c,!1,!1,a,b),this.adjustPoints(0,p,f-1,k)),!h)if(this.Pj(),n){f=this.getLinkPoint(a,b,g,!0,!1,d,e);p=this.getLinkPoint(d,e,c,!1,!1,a,b);h=p.x-f.x;k=p.y-f.y;l=this.computeCurviness();n=m=0;var r=f.x+h/3,q=f.y+k/3,u=r,w=q;L.w(k,0)?w=0<h?w-l:w+l:(m=-h/k,n=Math.sqrt(l*l/(m*m+1)),0>l&&(n=-n),u=
(0>k?-1:1)*n+r,w=m*(u-r)+q);r=f.x+2*h/3;q=f.y+2*k/3;var v=r,A=q;L.w(k,0)?A=0<h?A-l:A+l:(v=(0>k?-1:1)*n+r,A=m*(v-r)+q);this.Pj();this.ee(f);this.tf(u,w);this.tf(v,A);this.ee(p);this.Qc(0,this.getLinkPoint(a,b,g,!0,!1,d,e));this.Qc(3,this.getLinkPoint(d,e,c,!1,!1,a,b))}else if(f=d,p=e,d=this.getLinkPoint(a,b,g,!0,!1,f,p),e=this.getLinkPoint(f,p,c,!1,!1,a,b),this.hasCurviness())p=e.x-d.x,c=e.y-d.y,g=this.computeCurviness(),a=d.x+p/2,b=d.y+c/2,f=a,h=b,L.w(c,0)?h=0<p?h-g:h+g:(p=-p/c,f=Math.sqrt(g*g/(p*
p+1)),0>g&&(f=-f),f=(0>c?-1:1)*f+a,h=p*(f-a)+b),this.ee(d),this.tf(f,h),this.ee(e);else{this.ee(d);this.ee(e);h=M.alloc();b.Li(h);k=h.$(e);p.Li(h);l=h.$(d);if(k||l)g=b.da(ip(g),new J),this.Qc(0,this.getLinkPointFromPoint(a,b,g,e,!0,g)),c=p.da(ip(c),new J),this.Qc(1,this.getLinkPointFromPoint(f,p,c,d,!1,c));M.free(h)}}else{n=this.isAvoiding;p&&(m&&n||l)&&this.Pj();var y=l?this.computeCurviness():0;n=this.getLinkPoint(a,b,g,!0,m,d,e);r=u=q=0;if(m||!h||l)w=this.computeEndSegmentLength(a,b,g,!0),r=this.getLinkDirection(a,
b,n,g,!0,m,d,e),l&&(h||g.A(c)||!m&&1===g.x+c.x&&1===g.y+c.y)&&(r-=m?90:30,0>y&&(r-=180)),0>r?r+=360:360<=r&&(r-=360),l&&(w+=Math.abs(y)*(m?1:2)),0===r?q=w:90===r?u=w:180===r?q=-w:270===r?u=-w:(q=w*Math.cos(r*Math.PI/180),u=w*Math.sin(r*Math.PI/180)),g.Ac()&&l&&(w=b.da(xc,J.alloc()),v=J.allocAt(w.x+1E3*q,w.y+1E3*u),this.getLinkPointFromPoint(a,b,w,v,!0,n),J.free(w),J.free(v));w=this.getLinkPoint(d,e,c,!1,m,a,b);var B=A=v=0;if(m||!k||l){var z=this.computeEndSegmentLength(d,e,c,!1);B=this.getLinkDirection(d,
e,w,c,!1,m,a,b);l&&(k||g.A(c)||!m&&1===g.x+c.x&&1===g.y+c.y)&&(B+=m?0:30,0>y&&(B+=180));0>B?B+=360:360<=B&&(B-=360);l&&(z+=Math.abs(y)*(m?1:2));0===B?v=z:90===B?A=z:180===B?v=-z:270===B?A=-z:(v=z*Math.cos(B*Math.PI/180),A=z*Math.sin(B*Math.PI/180));c.Ac()&&l&&(c=e.da(xc,J.alloc()),g=J.allocAt(c.x+1E3*v,c.y+1E3*A),this.getLinkPointFromPoint(d,e,c,g,!1,w),J.free(c),J.free(g))}c=n;if(m||!h||l)c=new J(n.x+q,n.y+u);g=w;if(m||!k||l)g=new J(w.x+v,w.y+A);!p&&!m&&h&&3<f&&this.adjustPoints(0,n,f-2,g)?this.Qc(f-
1,w):!p&&!m&&k&&3<f&&this.adjustPoints(1,c,f-1,w)?this.Qc(0,n):!p&&(m?6<=f:4<f)&&this.adjustPoints(1,c,f-2,g)?(this.Qc(0,n),this.Qc(f-1,w)):(this.Pj(),this.ee(n),(m||!h||l)&&this.ee(c),m&&this.addOrthoPoints(c,r,g,B,a,d),(m||!k||l)&&this.ee(g),this.ee(w))}return!0};function jp(a,b){Math.abs(b.x-a.x)>Math.abs(b.y-a.y)?(b.x>=a.x?b.x=a.x+9E9:b.x=a.x-9E9,b.y=a.y):(b.y>=a.y?b.y=a.y+9E9:b.y=a.y-9E9,b.x=a.x);return b}
T.prototype.getLinkPointFromPoint=function(a,b,c,d,e,f){void 0===f&&(f=new J);if(null===a||null===b)return f.assign(c),f;a.isVisible()||(e=a.findVisibleNode(),null!==e&&e!==a&&(b=e.port));a=null;e=b.panel;null===e||e.je()||(e=e.panel);if(null===e){e=d.x;d=d.y;var g=c.x;c=c.y}else{a=e.fe;e=1/(a.m11*a.m22-a.m12*a.m21);g=a.m22*e;var h=-a.m12*e,k=-a.m21*e,l=a.m11*e,m=e*(a.m21*a.dy-a.m22*a.dx),n=e*(a.m12*a.dx-a.m11*a.dy);e=d.x*g+d.y*k+m;d=d.x*h+d.y*l+n;g=c.x*g+c.y*k+m;c=c.x*h+c.y*l+n}b.Zj(e,d,g,c,f);null!==
a&&f.transform(a);return f};function kp(a,b){var c=b.Qo;null===c&&(c=new lp,c.port=b,c.node=b.part,b.Qo=c);return mp(c,a)}
T.prototype.getLinkPoint=function(a,b,c,d,e,f,g,h){void 0===h&&(h=new J);if(c.hb()&&!hp(c))return b.da(c,h),h;if(c.Oc()){var k=kp(this,b);if(null!==k){h.assign(k.gq);if(e&&this.routing===np){var l=kp(this,g);if(null!==l&&k.Wl<l.Wl){k=J.alloc();l=J.alloc();var m=new M(b.da(tc,k),b.da(Bc,l)),n=this.computeSpot(!d,g);a=this.getLinkPoint(f,g,n,!d,e,a,b,l);(c.Df(Ec)||c.Df(Fc))&&a.y>=m.y&&a.y<=m.y+m.height?h.y=a.y:(c.Df(Dc)||c.Df(Gc))&&a.x>=m.x&&a.x<=m.x+m.width&&(h.x=a.x);J.free(k);J.free(l)}}return h}}c=
b.da(ip(c),J.alloc());this.pointsCount>(e?6:2)?(g=d?this.i(1):this.i(this.pointsCount-2),e&&(g=jp(c,g.copy()))):(k=this.computeSpot(!d,g),f=J.alloc(),g=g.da(ip(k),f),e&&(g=jp(c,g)),J.free(f));this.getLinkPointFromPoint(a,b,c,g,d,h);J.free(c);return h};
T.prototype.getLinkDirection=function(a,b,c,d,e,f,g,h){a:if(d.hb())var k=d.x>d.y?d.x>1-d.y?0:d.x<1-d.y?270:315:d.x<d.y?d.x>1-d.y?90:d.x<1-d.y?180:135:.5>d.x?225:.5<d.x?45:0;else{if(d.Oc()&&(k=kp(this,b),null!==k))switch(k.Bc){case 1:k=270;break a;case 2:k=180;break a;default:case 4:k=0;break a;case 8:k=90;break a}k=b.da(xc,J.alloc());this.pointsCount>(f?6:2)?(h=e?this.i(1):this.i(this.pointsCount-2),h=f?jp(k,h.copy()):c):(c=J.alloc(),h=h.da(xc,c),J.free(c));c=Math.abs(h.x-k.x)>Math.abs(h.y-k.y)?h.x>=
k.x?0:180:h.y>=k.y?90:270;J.free(k);k=c}d.Ac()&&g.Jd(a)&&(k+=180,360<=k&&(k-=360));if(hp(d))return k;a=b.Ki();if(0===a)return k;45<=a&&135>a?k+=90:135<=a&&225>a?k+=180:225<=a&&315>a&&(k+=270);360<=k&&(k-=360);return k};T.prototype.computeEndSegmentLength=function(a,b,c,d){if(null!==b&&c.Oc()&&(a=kp(this,b),null!==a))return a.Ju;a=d?this.fromEndSegmentLength:this.toEndSegmentLength;null!==b&&isNaN(a)&&(a=d?b.fromEndSegmentLength:b.toEndSegmentLength);isNaN(a)&&(a=10);return a};
T.prototype.computeSpot=function(a,b){void 0===b&&(b=null);a?(a=b?b:this.fromPort,null===a?a=xc:(b=this.fromSpot,b.Mb()&&(b=a.fromSpot),a=b===Tc?qc:b)):(a=b?b:this.toPort,null===a?a=xc:(b=this.toSpot,b.Mb()&&(b=a.toSpot),a=b===Tc?qc:b));return a};function hp(a){return a===qc||.5===a.x&&.5===a.y}function ip(a){return.5===a.x&&.5===a.y?a:xc}
T.prototype.computeOtherPoint=function(a,b){if(this.computeAdjusting()!==Rf&&4<this.pointsCount)return this.computeMidPoint(new J);a=b.Qo;a=null!==a?mp(a,this):null;return null!==a?a.gq:b.da(xc)};T.prototype.computeShortLength=function(a){if(a){a=this.fromShortLength;if(isNaN(a)){var b=this.fromPort;null!==b&&(a=b.fromShortLength)}return isNaN(a)?0:a}a=this.toShortLength;isNaN(a)&&(b=this.toPort,null!==b&&(a=b.toShortLength));return isNaN(a)?0:a};
T.prototype.zf=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var g=f;void 0===f&&(g=nd.alloc(),g.reset());g.multiply(this.transform);if(this.Ah(a,g))return Xm(this,b,c,e),void 0===f&&nd.free(g),!0;if(this.Mc(a,g)){var h=!1;if(!this.isAtomic)for(var k=this.T.m,l=k.length;l--;){var m=k[l];if(m.visible||m===this.locationObject){var n=m.actualBounds,p=this.naturalBounds;if(!(n.x>p.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=nd.alloc();n.set(g);
if(m instanceof X)h=m.zf(a,b,c,d,e,n);else if(this.path===m){if(m instanceof xf)if(h=a,p=d,!1===m.pickable)h=!1;else if(n.multiply(m.transform),p)b:{var r=h,q=n;if(m.Ah(r,q))h=!0;else{if(void 0===q&&(q=m.transform,r.Ge(m.actualBounds))){h=!0;break b}h=r.left;p=r.right;var u=r.top;r=r.bottom;var w=J.alloc(),v=J.alloc(),A=J.alloc(),y=nd.alloc();y.set(q);y.lv(m.transform);y.As();v.x=p;v.y=u;v.transform(y);w.x=h;w.y=u;w.transform(y);q=!1;zn(m,w,v,A)?q=!0:(w.x=p,w.y=r,w.transform(y),zn(m,w,v,A)?q=!0:(v.x=
h,v.y=r,v.transform(y),zn(m,w,v,A)?q=!0:(w.x=h,w.y=u,w.transform(y),zn(m,w,v,A)&&(q=!0))));nd.free(y);J.free(w);J.free(v);J.free(A);h=q}}else h=m.Ah(h,n)}else h=al(m,a,d,n);h&&(p=m,null!==b&&(p=b(m)),p&&(null===c||c(p))&&e.add(p));nd.free(n)}}}void 0===f&&nd.free(g);return h||null!==this.background||null!==this.areaBackground}void 0===f&&nd.free(g);return!1};
T.prototype.computeCurve=function(){if(null===this.Qf){var a=this.fromPort,b=this.isOrthogonal;this.Qf=null!==a&&a===this.toPort&&!b}return this.Qf?Uf:this.curve};T.prototype.computeCorner=function(){if(this.curve===Uf)return 0;var a=this.corner;if(isNaN(a)||0>a)a=10;return a};
T.prototype.findMidLabel=function(){for(var a=this.path,b=this.T.m,c=b.length,d=0;d<c;d++){var e=b[d];if(e!==a&&!e.isPanelMain&&(-Infinity===e.segmentIndex||isNaN(e.segmentIndex)))return e}for(a=this.labelNodes;a.next();)if(b=a.value,-Infinity===b.segmentIndex||isNaN(b.segmentIndex))return b;return null};
T.prototype.computeSpacing=function(){if(!this.isVisible())return 0;var a=op;a=Math.max(a,this.computeThickness());var b=this.fromPort,c=this.toPort;if(null!==b&&null!==c){var d=this.findMidLabel();if(null!==d){var e=d.naturalBounds,f=d.margin,g=isNaN(e.width)?30:e.width*d.scale+f.left+f.right;e=isNaN(e.height)?14:e.height*d.scale+f.top+f.bottom;d=d.segmentOrientation;d===Lm||d===Mm||d===$o?a=Math.max(a,e):d===Gm||d===Hm||d===Em||d===Fm?a=Math.max(a,g):(b=b.da(xc).Pa(c.da(xc))/180*Math.PI,a=Math.max(a,
Math.abs(Math.sin(b)*g)+Math.abs(Math.cos(b)*e)+1));this.curve===Uf&&(a*=1.333)}}return a};T.prototype.arrangeBundledLinks=function(a,b){if(b)for(b=0;b<a.length;b++){var c=a[b];c.computeAdjusting()===Rf&&c.Va()}};
T.prototype.computeCurviness=function(){var a=this.curviness;if(isNaN(a)){a=pp;var b=this.Mf;if(null!==b){for(var c=Ga(),d=0,e=b.links,f=0;f<e.length;f++){var g=e[f].computeSpacing();c.push(g);d+=g}d=-d/2;for(f=0;f<e.length;f++){if(e[f]===this){a=d+c[f]/2;break}d+=c[f]}b.Js===this.fromNode&&(a=-a);Ja(c)}}return a};T.prototype.computeThickness=function(){if(!this.isVisible())return 0;var a=this.path;return null!==a?Math.max(a.strokeWidth,1):1};
T.prototype.hasCurviness=function(){return!isNaN(this.curviness)||null!==this.Mf};
T.prototype.adjustPoints=function(a,b,c,d){var e=this.computeAdjusting();if(this.isOrthogonal){if(e===Yo)return!1;e===Zo&&(e=Xo)}switch(e){case Yo:var f=this.i(a),g=this.i(c);if(!f.Ua(b)||!g.Ua(d)){e=f.x;f=f.y;var h=g.x-e,k=g.y-f,l=Math.sqrt(h*h+k*k);if(!L.aa(l,0)){if(L.aa(h,0))var m=0>k?-Math.PI/2:Math.PI/2;else m=Math.atan(k/Math.abs(h)),0>h&&(m=Math.PI-m);g=b.x;var n=b.y;h=d.x-g;var p=d.y-n;k=Math.sqrt(h*h+p*p);L.aa(h,0)?p=0>p?-Math.PI/2:Math.PI/2:(p=Math.atan(p/Math.abs(h)),0>h&&(p=Math.PI-p));
l=k/l;m=p-m;this.Qc(a,b);for(a+=1;a<c;a++)b=this.i(a),h=b.x-e,k=b.y-f,b=Math.sqrt(h*h+k*k),L.aa(b,0)||(L.aa(h,0)?k=0>k?-Math.PI/2:Math.PI/2:(k=Math.atan(k/Math.abs(h)),0>h&&(k=Math.PI-k)),h=k+m,b*=l,this.M(a,g+b*Math.cos(h),n+b*Math.sin(h)));this.Qc(c,d)}}return!0;case Zo:f=this.i(a);n=this.i(c);if(!f.Ua(b)||!n.Ua(d)){e=f.x;f=f.y;g=n.x;n=n.y;l=(g-e)*(g-e)+(n-f)*(n-f);h=b.x;m=b.y;k=d.x;p=d.y;var r=1;if(0!==k-h){var q=(p-m)/(k-h);r=Math.sqrt(1+1/(q*q))}else q=9E9;this.Qc(a,b);for(a+=1;a<c;a++){b=this.i(a);
var u=b.x,w=b.y,v=.5;0!==l&&(v=((e-u)*(e-g)+(f-w)*(f-n))/l);var A=e+v*(g-e),y=f+v*(n-f);b=Math.sqrt((u-A)*(u-A)+(w-y)*(w-y));w<q*(u-A)+y&&(b=-b);0<q&&(b=-b);u=h+v*(k-h);v=m+v*(p-m);0!==q?(b=u+b/r,this.M(a,b,v-(b-u)/q)):this.M(a,u,v+b)}this.Qc(c,d)}return!0;case Xo:a:{if(this.isOrthogonal&&(e=this.i(a),f=this.i(a+1),g=this.i(a+2),h=f.x,m=f.y,n=h,l=m,L.w(e.y,f.y)?L.w(f.x,g.x)?m=b.y:L.w(f.y,g.y)&&(h=b.x):L.w(e.x,f.x)&&(L.w(f.y,g.y)?h=b.x:L.w(f.x,g.x)&&(m=b.y)),this.M(a+1,h,m),e=this.i(c),f=this.i(c-
1),g=this.i(c-2),h=f.x,m=f.y,k=h,p=m,L.w(e.y,f.y)?L.w(f.x,g.x)?m=d.y:L.w(f.y,g.y)&&(h=d.x):L.w(e.x,f.x)&&(L.w(f.y,g.y)?h=d.x:L.w(f.x,g.x)&&(m=d.y)),this.M(c-1,h,m),Fj(this))){this.M(a+1,n,l);this.M(c-1,k,p);c=!1;break a}this.Qc(a,b);this.Qc(c,d);c=!0}return c;default:return!1}};
T.prototype.addOrthoPoints=function(a,b,c,d,e,f){0>b?b+=360:360<=b&&(b-=360);0>d?d+=360:360<=d&&(d-=360);var g=d;b=315<=b||45>b?0:45<=b&&135>b?90:135<=b&&225>b?180:270;d=315<=d||45>d?0:45<=d&&135>d?90:135<=d&&225>d?180:270;var h=e.actualBounds.copy(),k=f.actualBounds.copy();if(h.u()&&k.u()){h.Kc(qp,qp);k.Kc(qp,qp);h.Oe(a);k.Oe(c);var l=J.alloc(),m=J.alloc();if(0===b)if(c.x>a.x||270===d&&c.y<a.y&&k.right>a.x||90===d&&c.y>a.y&&k.right>a.x)l.h(c.x,a.y),m.h(c.x,(a.y+c.y)/2),180===d?(l.x=this.computeMidOrthoPosition(a.x,
a.y,c.x,c.y,!1),m.x=l.x,m.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(l.x=a.x<k.left?this.computeMidOrthoPosition(a.x,a.y,k.left,c.y,!1):a.x<k.right&&(270===d&&a.y<k.top||90===d&&a.y>k.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):k.right,m.x=l.x,m.y=c.y):0===d&&a.x<k.left&&a.y>k.top&&a.y<k.bottom&&(l.x=a.x,l.y=a.y<c.y?Math.min(c.y,k.top):Math.max(c.y,k.bottom),m.y=l.y);else{l.h(a.x,c.y);m.h((a.x+c.x)/2,c.y);if(180===d||90===d&&c.y<h.top||270===d&&c.y>h.bottom)180===d&&(k.$(a)||h.$(c))?l.y=
this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):c.y<a.y&&(180===d||90===d)?l.y=this.computeMidOrthoPosition(a.x,h.top,c.x,Math.max(c.y,k.bottom),!0):c.y>a.y&&(180===d||270===d)&&(l.y=this.computeMidOrthoPosition(a.x,h.bottom,c.x,Math.min(c.y,k.top),!0)),m.x=c.x,m.y=l.y;if(l.y>h.top&&l.y<h.bottom)if(c.x>=h.left&&c.x<=a.x||a.x<=k.right&&a.x>=c.x){if(90===d||270===d)l.h(Math.max((a.x+c.x)/2,a.x),a.y),m.h(l.x,c.y)}else l.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,0===d?h.top:Math.min(h.top,k.top)):
Math.max(c.y,0===d?h.bottom:Math.max(h.bottom,k.bottom)),m.x=c.x,m.y=l.y}else if(180===b)if(c.x<a.x||270===d&&c.y<a.y&&k.left<a.x||90===d&&c.y>a.y&&k.left<a.x)l.h(c.x,a.y),m.h(c.x,(a.y+c.y)/2),0===d?(l.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1),m.x=l.x,m.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(l.x=a.x>k.right?this.computeMidOrthoPosition(a.x,a.y,k.right,c.y,!1):a.x>k.left&&(270===d&&a.y<k.top||90===d&&a.y>k.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):k.left,m.x=l.x,m.y=c.y):
180===d&&a.x>k.right&&a.y>k.top&&a.y<k.bottom&&(l.x=a.x,l.y=a.y<c.y?Math.min(c.y,k.top):Math.max(c.y,k.bottom),m.y=l.y);else{l.h(a.x,c.y);m.h((a.x+c.x)/2,c.y);if(0===d||90===d&&c.y<h.top||270===d&&c.y>h.bottom)0===d&&(k.$(a)||h.$(c))?l.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):c.y<a.y&&(0===d||90===d)?l.y=this.computeMidOrthoPosition(a.x,h.top,c.x,Math.max(c.y,k.bottom),!0):c.y>a.y&&(0===d||270===d)&&(l.y=this.computeMidOrthoPosition(a.x,h.bottom,c.x,Math.min(c.y,k.top),!0)),m.x=c.x,m.y=
l.y;if(l.y>h.top&&l.y<h.bottom)if(c.x<=h.right&&c.x>=a.x||a.x>=k.left&&a.x<=c.x){if(90===d||270===d)l.h(Math.min((a.x+c.x)/2,a.x),a.y),m.h(l.x,c.y)}else l.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,180===d?h.top:Math.min(h.top,k.top)):Math.max(c.y,180===d?h.bottom:Math.max(h.bottom,k.bottom)),m.x=c.x,m.y=l.y}else if(90===b)if(c.y>a.y||180===d&&c.x<a.x&&k.bottom>a.y||0===d&&c.x>a.x&&k.bottom>a.y)l.h(a.x,c.y),m.h((a.x+c.x)/2,c.y),270===d?(l.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0),
m.x=c.x,m.y=l.y):180===d&&c.x<a.x||0===d&&c.x>a.x?(l.y=a.y<k.top?this.computeMidOrthoPosition(a.x,a.y,c.x,k.top,!0):a.y<k.bottom&&(180===d&&a.x<k.left||0===d&&a.x>k.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):k.bottom,m.x=c.x,m.y=l.y):90===d&&a.y<k.top&&a.x>k.left&&a.x<k.right&&(l.x=a.x<c.x?Math.min(c.x,k.left):Math.max(c.x,k.right),l.y=a.y,m.x=l.x);else{l.h(c.x,a.y);m.h(c.x,(a.y+c.y)/2);if(270===d||0===d&&c.x<h.left||180===d&&c.x>h.right)270===d&&(k.$(a)||h.$(c))?l.x=this.computeMidOrthoPosition(a.x,
a.y,c.x,c.y,!1):c.x<a.x&&(270===d||0===d)?l.x=this.computeMidOrthoPosition(h.left,a.y,Math.max(c.x,k.right),c.y,!1):c.x>a.x&&(270===d||180===d)&&(l.x=this.computeMidOrthoPosition(h.right,a.y,Math.min(c.x,k.left),c.y,!1)),m.x=l.x,m.y=c.y;if(l.x>h.left&&l.x<h.right)if(c.y>=h.top&&c.y<=a.y||a.y<=k.bottom&&a.y>=c.y){if(0===d||180===d)l.h(a.x,Math.max((a.y+c.y)/2,a.y)),m.h(c.x,l.y)}else l.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,90===d?h.left:Math.min(h.left,k.left)):Math.max(c.x,90===d?h.right:
Math.max(h.right,k.right)),m.x=l.x,m.y=c.y}else if(c.y<a.y||180===d&&c.x<a.x&&k.top<a.y||0===d&&c.x>a.x&&k.top<a.y)l.h(a.x,c.y),m.h((a.x+c.x)/2,c.y),90===d?(l.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0),m.x=c.x,m.y=l.y):180===d&&c.x<a.x||0===d&&c.x>=a.x?(l.y=a.y>k.bottom?this.computeMidOrthoPosition(a.x,a.y,c.x,k.bottom,!0):a.y>k.top&&(180===d&&a.x<k.left||0===d&&a.x>k.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):k.top,m.x=c.x,m.y=l.y):270===d&&a.y>k.bottom&&a.x>k.left&&a.x<k.right&&
(l.x=a.x<c.x?Math.min(c.x,k.left):Math.max(c.x,k.right),l.y=a.y,m.x=l.x);else{l.h(c.x,a.y);m.h(c.x,(a.y+c.y)/2);if(90===d||0===d&&c.x<h.left||180===d&&c.x>h.right)90===d&&(k.$(a)||h.$(c))?l.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):c.x<a.x&&(90===d||0===d)?l.x=this.computeMidOrthoPosition(h.left,a.y,Math.max(c.x,k.right),c.y,!1):c.x>a.x&&(90===d||180===d)&&(l.x=this.computeMidOrthoPosition(h.right,a.y,Math.min(c.x,k.left),c.y,!1)),m.x=l.x,m.y=c.y;if(l.x>h.left&&l.x<h.right)if(c.y<=h.bottom&&
c.y>=a.y||a.y>=k.top&&a.y<=c.y){if(0===d||180===d)l.h(a.x,Math.min((a.y+c.y)/2,a.y)),m.h(c.x,l.y)}else l.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,270===d?h.left:Math.min(h.left,k.left)):Math.max(c.x,270===d?h.right:Math.max(h.right,k.right)),m.x=l.x,m.y=c.y}var n=c;if(this.isAvoiding){var p=this.diagram;if(null===p||e===f||this.layer.isTemporary||!hk(p)||h.$(n)&&!f.Jd(e)||k.$(a)&&!e.Jd(f))b=!1;else{var r=ik(p,!0,this.containingGroup,null);if(17!==this.segmentIndex&&r.dk(Math.min(a.x,l.x),
Math.min(a.y,l.y),Math.abs(a.x-l.x),Math.abs(a.y-l.y))&&r.dk(Math.min(l.x,m.x),Math.min(l.y,m.y),Math.abs(l.x-m.x),Math.abs(l.y-m.y))&&r.dk(Math.min(m.x,n.x),Math.min(m.y,n.y),Math.abs(m.x-n.x),Math.abs(m.y-n.y)))b=!1;else{e=a;f=n;var q=c=null;if(p.isVirtualized){p=r.bounds.copy();p.Kc(-r.Qp,-r.Pp);var u=J.alloc();nk(r,a.x,a.y)||(L.Cf(p.x,p.y,p.x+p.width,p.y+p.height,a.x,a.y,l.x,l.y,u)?(c=a=u.copy(),b=u.Pa(l)):L.Cf(p.x,p.y,p.x+p.width,p.y+p.height,l.x,l.y,m.x,m.y,u)?(c=a=u.copy(),b=u.Pa(m)):L.Cf(p.x,
p.y,p.x+p.width,p.y+p.height,m.x,m.y,n.x,n.y,u)&&(c=a=u.copy(),b=u.Pa(n)));nk(r,n.x,n.y)||(L.Cf(p.x,p.y,p.x+p.width,p.y+p.height,n.x,n.y,m.x,m.y,u)?(q=n=u.copy(),d=m.Pa(u)):L.Cf(p.x,p.y,p.x+p.width,p.y+p.height,m.x,m.y,l.x,l.y,u)?(q=n=u.copy(),d=l.Pa(u)):L.Cf(p.x,p.y,p.x+p.width,p.y+p.height,l.x,l.y,a.x,a.y,u)&&(q=n=u.copy(),d=a.Pa(u)));J.free(u)}h=h.copy().Rc(k);h.Kc(r.Qp*r.zy,r.Pp*r.zy);rp(r,a,b,n,d,h,!0);k=sp(r,n.x,n.y);!r.abort&&k>=tp&&(mk(r),h.Kc(r.Qp*r.ey,r.Pp*r.ey),rp(r,a,b,n,d,h,!1),k=sp(r,
n.x,n.y));if(!r.abort&&k<tp&&sp(r,n.x,n.y)!==ok){up(this,r,n.x,n.y,d,!0,g);h=this.i(2);if(4>this.pointsCount)0===b||180===b?(h.x=a.x,h.y=n.y):(h.x=n.x,h.y=a.y),this.M(2,h.x,h.y),this.l(3,h.x,h.y);else if(g=this.i(3),0===b||180===b)L.w(h.x,g.x)?(h=0===b?Math.max(h.x,a.x):Math.min(h.x,a.x),this.M(2,h,a.y),this.M(3,h,g.y)):L.w(h.y,g.y)?(Math.abs(a.y-h.y)<=r.Pp/2&&(this.M(2,h.x,a.y),this.M(3,g.x,a.y)),this.l(2,h.x,a.y)):this.M(2,a.x,h.y);else if(90===b||270===b)L.w(h.y,g.y)?(h=90===b?Math.max(h.y,a.y):
Math.min(h.y,a.y),this.M(2,a.x,h),this.M(3,g.x,h)):L.w(h.x,g.x)?(Math.abs(a.x-h.x)<=r.Qp/2&&(this.M(2,a.x,h.y),this.M(3,a.x,g.y)),this.l(2,a.x,h.y)):this.M(2,h.x,a.y);null!==c&&(a=this.i(1),g=this.i(2),a.x!==g.x&&a.y!==g.y?0===b||180===b?this.l(2,a.x,g.y):this.l(2,g.x,a.y):0===b||180===b?this.l(2,e.x,c.y):this.l(2,c.x,e.y));null!==q&&(0===d||180===d?this.tf(f.x,q.y):this.tf(q.x,f.y));b=!0}else b=!1}}}else b=!1;b||(this.ee(l.copy()),this.ee(m.copy()));J.free(l);J.free(m)}};
T.prototype.computeMidOrthoPosition=function(a,b,c,d,e){var f=0;!this.hasCurviness()||this.computeSpot(!0,this.fromPort).Oc()||this.computeSpot(!1,this.toPort).Oc()||(f=this.computeCurviness());return e?(b+d)/2+f:(a+c)/2+f};
function Fj(a){if(null===a.diagram||!a.isAvoiding||!hk(a.diagram))return!1;var b=a.points.m,c=b.length;if(4>c)return!1;a=ik(a.diagram,!0,a.containingGroup,null);for(var d=1;d<c-2;d++){var e=b[d],f=b[d+1];if(!a.dk(Math.min(e.x,f.x),Math.min(e.y,f.y),Math.abs(e.x-f.x),Math.abs(e.y-f.y)))return!0}return!1}
function up(a,b,c,d,e,f,g){var h=b.Qp,k=b.Pp,l=sp(b,c,d),m=c,n=d;0===e?m+=h:90===e?n+=k:180===e?m-=h:n-=k;e!==g&&l>vp&&sp(b,m,n)!==l-1&&(sp(b,c-h,d)===l-1?(e=180,m=c-h,n=d):sp(b,c+h,d)===l-1?(e=0,m=c+h,n=d):sp(b,c,d-k)===l-1?(e=270,m=c,n=d-k):sp(b,c,d+k)===l-1&&(e=90,m=c,n=d+k));for(;l>vp&&sp(b,m,n)===l-1;)c=m,d=n,0===e?m+=h:90===e?n+=k:180===e?m-=h:n-=k,--l;if(f){if(l>vp)if(180===e||0===e)c=Math.floor(c/h)*h+h/2;else if(90===e||270===e)d=Math.floor(d/k)*k+k/2}else c=Math.floor(c/h)*h+h/2,d=Math.floor(d/
k)*k+k/2;l>vp&&(f=e,g=c,m=d,0===e?(f=90,m+=k):90===e?(f=180,g-=h):180===e?(f=270,m-=k):270===e&&(f=0,g+=h),sp(b,g,m)===l-1?up(a,b,g,m,f,!1,f):(g=c,m=d,0===e?(f=270,m-=k):90===e?(f=0,g+=h):180===e?(f=90,m+=k):270===e&&(f=180,g-=h),sp(b,g,m)===l-1&&up(a,b,g,m,f,!1,f)));a.tf(c,d)}T.prototype.Dz=function(a){var b=a.x;a=a.y;for(var c=this.i(0),d=this.i(1),e=zb(b,a,c.x,c.y,d.x,d.y),f=0,g=1;g<this.pointsCount-1;g++){c=this.i(g+1);var h=zb(b,a,d.x,d.y,c.x,c.y);d=c;h<e&&(f=g,e=h)}return f};
T.prototype.fc=function(a){this.Bm=!1;a&&this.s()};T.prototype.fk=function(a){if(!a){if(!1===this.ud)return;a=this.pb();if(this.Bm&&(null===a||null!==a.geometry))return}this.ma=this.makeGeometry();a=this.path;if(null!==a){a.ma=this.ma;for(var b=this.T.m,c=b.length,d=0;d<c;d++){var e=b[d];e!==a&&e.isPanelMain&&e instanceof xf&&(e.ma=this.ma)}}};
T.prototype.makeGeometry=function(){var a=this.ma,b=this.pointsCount;if(2>b)return a.type=P.j,this.Bm=!0,a;var c=!1,d=this.diagram;null!==d&&ap(this)&&d.Xh.contains(this)&&(0!==this.wl.width||0!==this.wl.height)&&(c=!0);var e=this.i(0).copy(),f=e.copy();d=this.Cb.m;var g=this.computeCurve();if(g===Uf&&3<=b&&!L.aa(this.smoothness,0))if(3===b){var h=this.i(1);d=Math.min(e.x,h.x);var k=Math.min(e.y,h.y);h=this.i(2);d=Math.min(d,h.x);k=Math.min(k,h.y)}else{if(this.isOrthogonal)for(k=0;k<b;k++)h=d[k],
f.x=Math.min(h.x,f.x),f.y=Math.min(h.y,f.y);else for(d=3;d<b;d+=3)d+3>=b&&(d=b-1),k=this.i(d),f.x=Math.min(k.x,f.x),f.y=Math.min(k.y,f.y);d=f.x;k=f.y}else{for(k=0;k<b;k++)h=d[k],f.x=Math.min(h.x,f.x),f.y=Math.min(h.y,f.y);d=f.x;k=f.y}d-=this.lu.x;k-=this.lu.y;e.x-=d;e.y-=k;if(2!==b||ap(this)){a.type=P.o;h=sd(a);0!==this.computeShortLength(!0)&&(e=wp(this,e,!0,f));td(h,e.x,e.y,!1);if(g===Uf&&3<=b&&!L.aa(this.smoothness,0))if(3===b)c=this.i(1),b=c.x-d,c=c.y-k,e=this.i(2).copy(),e.x-=d,e.y-=k,0!==this.computeShortLength(!1)&&
(e=wp(this,e,!1,f)),yd(h,b,c,b,c,e.x,e.y);else if(this.isOrthogonal){b=J.allocAt(d,k);c=J.alloc();c.assign(this.i(1));f=J.allocAt(d,k);e=J.allocAt(d,k);g=this.i(0);for(var l,m=this.smoothness/3,n=1;n<this.pointsCount-1;n++){l=this.i(n);var p=g,r=l,q=this.i(xp(this,l,n,!1));if(!L.aa(p.x,r.x)||!L.aa(r.x,q.x))if(!L.aa(p.y,r.y)||!L.aa(r.y,q.y)){var u=m;isNaN(u)&&(u=this.smoothness/3);var w=p.x;p=p.y;var v=r.x;r=r.y;var A=q.x;q=q.y;var y=u*yp(w,p,v,r);u*=yp(v,r,A,q);L.aa(p,r)&&L.aa(v,A)&&(v>w?q>r?(f.x=
v-y,f.y=r-y,e.x=v+u,e.y=r+u):(f.x=v-y,f.y=r+y,e.x=v+u,e.y=r-u):q>r?(f.x=v+y,f.y=r-y,e.x=v-u,e.y=r+u):(f.x=v+y,f.y=r+y,e.x=v-u,e.y=r-u));L.aa(w,v)&&L.aa(r,q)&&(r>p?(A>v?(f.x=v-y,f.y=r-y,e.x=v+u):(f.x=v+y,f.y=r-y,e.x=v-u),e.y=r+u):(A>v?(f.x=v-y,f.y=r+y,e.x=v+u):(f.x=v+y,f.y=r+y,e.x=v-u),e.y=r-u));if(L.aa(w,v)&&L.aa(v,A)||L.aa(p,r)&&L.aa(r,q))w=.5*(w+A),p=.5*(p+q),f.x=w,f.y=p,e.x=w,e.y=p;1===n?(c.x=.5*(g.x+l.x),c.y=.5*(g.y+l.y)):2===n&&L.aa(g.x,this.i(0).x)&&L.aa(g.y,this.i(0).y)&&(c.x=.5*(g.x+l.x),
c.y=.5*(g.y+l.y));yd(h,c.x-d,c.y-k,f.x-d,f.y-k,l.x-d,l.y-k);b.set(f);c.set(e);g=l}}l=g.x;g=g.y;m=this.i(this.pointsCount-1);0!==this.computeShortLength(!1)&&(m=wp(this,m.copy(),!1,qb));l=.5*(l+m.x);g=.5*(g+m.y);yd(h,e.x-d,e.y-k,l-d,g-k,m.x-d,m.y-k);J.free(b);J.free(c);J.free(f);J.free(e)}else for(c=3;c<b;c+=3)f=this.i(c-2),c+3>=b&&(c=b-1),e=this.i(c-1),g=this.i(c),c===b-1&&0!==this.computeShortLength(!1)&&(g=wp(this,g.copy(),!1,qb)),yd(h,f.x-d,f.y-k,e.x-d,e.y-k,g.x-d,g.y-k);else{f=J.alloc();f.assign(this.i(0));
e=J.alloc();e.assign(f);g=this.computeCorner();n=1;for(l=0;n<b;){n=xp(this,f,n,1<n);m=this.i(n);if(n>=b-1){if(!f.A(m))0!==this.computeShortLength(!1)&&(m=wp(this,m.copy(),!1,qb)),zp(this,h,-d,-k,f,m,c);else if(0===l)for(n=1;n<b;)e.assign(f),m=this.i(n++),zp(this,h,-d,-k,f,m,c),f.assign(m);break}l=xp(this,m,n+1,n<b-3);n=-d;w=-k;p=m;v=this.i(l);u=c;if(L.w(f.y,p.y)&&L.w(p.x,v.x))if(q=Math.min(g,Math.abs(p.x-e.x)/2),q=y=Math.min(q,Math.abs(v.y-p.y)/2),L.w(q,0))zp(this,h,n,w,f,p,u),f.assign(p);else{var B=
p.x,z=p.y;r=B;A=z;p.x>f.x?B=p.x-q:B=p.x+q;v.y>p.y?A=p.y+y:A=p.y-y;v=J.allocAt(B,z);zp(this,h,n,w,f,v,u);J.free(v);zd(h,p.x+n,p.y+w,r+n,A+w);f.h(r,A)}else L.w(f.x,p.x)&&L.w(p.y,v.y)?(q=Math.min(g,Math.abs(p.y-e.y)/2),q=y=Math.min(q,Math.abs(v.x-p.x)/2),L.w(y,0)?(zp(this,h,n,w,f,p,u),f.assign(p)):(B=p.x,z=p.y,r=B,A=z,p.y>f.y?z=p.y-q:z=p.y+q,v.x>p.x?r=p.x+y:r=p.x-y,v=J.allocAt(B,z),zp(this,h,n,w,f,v,u),J.free(v),zd(h,p.x+n,p.y+w,r+n,A+w),f.h(r,A))):(zp(this,h,n,w,f,p,u),f.assign(p));e.assign(m);n=l}J.free(f)}Cd=
h}else h=this.i(1).copy(),h.x-=d,h.y-=k,0!==this.computeShortLength(!0)&&(e=wp(this,e,!0,f)),0!==this.computeShortLength(!1)&&(h=wp(this,h,!1,f)),a.type=P.j,a.startX=e.x,a.startY=e.y,a.endX=h.x,a.endY=h.y;this.Bm=!0;return a};function yp(a,b,c,d){a=c-a;if(isNaN(a)||Infinity===a||-Infinity===a)return NaN;0>a&&(a=-a);b=d-b;if(isNaN(b)||Infinity===b||-Infinity===b)return NaN;0>b&&(b=-b);return L.aa(a,0)?b:L.aa(b,0)?a:Math.sqrt(a*a+b*b)}
function wp(a,b,c,d){var e=a.pointsCount;if(2>e)return b;if(c){var f=a.i(1);c=f.x-d.x;f=f.y-d.y;d=yp(b.x,b.y,c,f);if(0===d)return b;e=2===e?.5*d:d;a=a.computeShortLength(!0);a>e&&(a=e);e=a*(f-b.y)/d;b.x+=a*(c-b.x)/d;b.y+=e}else{f=a.i(e-2);c=f.x-d.x;f=f.y-d.y;d=yp(b.x,b.y,c,f);if(0===d)return b;e=2===e?.5*d:d;a=a.computeShortLength(!1);a>e&&(a=e);e=a*(b.y-f)/d;b.x-=a*(b.x-c)/d;b.y-=e}return b}
function xp(a,b,c,d){for(var e=a.pointsCount,f=b;L.aa(b.x,f.x)&&L.aa(b.y,f.y);){if(c>=e)return e-1;f=a.i(c++)}if(!L.aa(b.x,f.x)&&!L.aa(b.y,f.y))return c-1;for(var g=f;L.aa(b.x,f.x)&&L.aa(f.x,g.x)&&(!d||(b.y>=f.y?f.y>=g.y:f.y<=g.y))||L.aa(b.y,f.y)&&L.aa(f.y,g.y)&&(!d||(b.x>=f.x?f.x>=g.x:f.x<=g.x));){if(c>=e)return e-1;g=a.i(c++)}return c-2}T.prototype.computeJumpLength=function(){return 10};
function zp(a,b,c,d,e,f,g){if(!g&&ap(a)){g=a.computeJumpLength();var h=g/2,k=[],l=0;a.isVisible()&&(l=Ap(a,e,f,k));if(0<l)if(L.w(e.y,f.y))if(e.x<f.x)for(var m=0;m<l;){var n=Math.max(e.x,Math.min(k[m++]-h,f.x-g));b.lineTo(n+c,f.y+d);var p=n+c;for(var r=Math.min(n+g,f.x);m<l;)if(n=k[m],n<r+g)m++,r=Math.min(n+h,f.x);else break;n=f.y-g+d;r+=c;var q=f.y+d;a.curve===Qf?td(b,r,q,!1):yd(b,p,n,r,n,r,q)}else for(--l;0<=l;){m=Math.min(e.x,Math.max(k[l--]+h,f.x+g));b.lineTo(m+c,f.y+d);p=m+c;for(n=Math.max(m-
g,f.x);0<=l;)if(m=k[l],m>n-g)l--,n=Math.max(m-h,f.x);else break;m=f.y-g+d;n+=c;r=f.y+d;a.curve===Qf?td(b,n,r,!1):yd(b,p,m,n,m,n,r)}else if(L.w(e.x,f.x))if(e.y<f.y)for(m=0;m<l;){n=Math.max(e.y,Math.min(k[m++]-h,f.y-g));b.lineTo(f.x+c,n+d);p=n+d;for(n=Math.min(n+g,f.y);m<l;)if(r=k[m],r<n+g)m++,n=Math.min(r+h,f.y);else break;r=f.x-g+c;q=f.x+c;n+=d;a.curve===Qf?td(b,q,n,!1):yd(b,r,p,r,n,q,n)}else for(--l;0<=l;){m=Math.min(e.y,Math.max(k[l--]+h,f.y+g));b.lineTo(f.x+c,m+d);p=m+d;for(m=Math.max(m-g,f.y);0<=
l;)if(n=k[l],n>m-g)l--,m=Math.max(n-h,f.y);else break;n=f.x-g+c;r=f.x+c;m+=d;a.curve===Qf?td(b,r,m,!1):yd(b,n,p,n,m,r,m)}}b.lineTo(f.x+c,f.y+d)}
function Ap(a,b,c,d){var e=a.diagram;if(null===e||b.A(c))return 0;for(e=e.layers;e.next();){var f=e.value;if(null!==f&&f.visible){f=f.Ha.m;for(var g=f.length,h=0;h<g;h++){var k=f[h];if(k instanceof T){if(k===a)return 0<d.length&&d.sort(function(a,b){return a-b}),d.length;if(k.isVisible()&&ap(k)){var l=k.routeBounds;l.u()&&a.routeBounds.Mc(l)&&!a.usesSamePort(k)&&(l=k.path,null!==l&&l.Ff()&&Bp(b,c,d,k))}}}}}0<d.length&&d.sort(function(a,b){return a-b});return d.length}
function Bp(a,b,c,d){for(var e=L.w(a.y,b.y),f=d.pointsCount,g=d.i(0),h=J.alloc(),k=1;k<f;k++){var l=d.i(k);if(k<f-1){var m=d.i(k+1);if(g.y===l.y&&l.y===m.y){if(l.x>g.x&&m.x>=l.x||l.x<g.x&&m.x<=l.x)continue}else if(g.x===l.x&&l.x===m.x&&(l.y>g.y&&m.y>=l.y||l.y<g.y&&m.y<=l.y))continue}a:{m=a.x;var n=a.y,p=b.x,r=b.y,q=g.x;g=g.y;var u=l.x,w=l.y;if(!L.w(m,p)){if(L.w(n,r)&&L.w(q,u)&&Math.min(m,p)<q&&Math.max(m,p)>q&&Math.min(g,w)<n&&Math.max(g,w)>n&&!L.w(g,w)){h.x=q;h.y=n;m=!0;break a}}else if(!L.w(n,r)&&
L.w(g,w)&&Math.min(n,r)<g&&Math.max(n,r)>g&&Math.min(q,u)<m&&Math.max(q,u)>m&&!L.w(q,u)){h.x=m;h.y=g;m=!0;break a}h.x=0;h.y=0;m=!1}m&&(e?c.push(h.x):c.push(h.y));g=l}J.free(h)}function ap(a){a=a.curve;return a===Pf||a===Qf}function ep(a,b){if(b||ap(a))b=a.diagram,null===b||b.animationManager.isTicking||b.Xh.contains(a)||0===a.wl.width&&0===a.wl.height||b.Xh.add(a,a.wl.copy())}
T.prototype.eq=function(a){var b=this.layer;if(null!==b&&b.visible&&!b.isTemporary){var c=b.diagram;if(null!==c&&!c.animationManager.isTicking){var d=!1;for(c=c.layers;c.next();){var e=c.value;if(e.visible)if(e===b){d=!0;var f=!1;e=e.Ha.m;for(var g=e.length,h=0;h<g;h++){var k=e[h];k instanceof T&&(k===this?f=!0:f&&Cp(this,k,a))}}else if(d)for(f=e.Ha.m,e=f.length,g=0;g<e;g++)h=f[g],h instanceof T&&Cp(this,h,a)}}}};
function Cp(a,b,c){if(null!==b&&b.Bm&&b.ud&&ap(b)){var d=b.routeBounds;d.u()&&(a.routeBounds.Mc(d)||c.Mc(d))&&(a.usesSamePort(b)||b.fc(!1))}}T.prototype.usesSamePort=function(a){var b=this.pointsCount,c=a.pointsCount;if(0<b&&0<c){var d=this.i(0),e=a.i(0);if(d.Ua(e))return!0;b=this.i(b-1);a=a.i(c-1);if(b.Ua(a)||d.Ua(a)||b.Ua(e))return!0}else if(this.fromNode===a.fromNode||this.toNode===a.toNode||this.fromNode===a.toNode||this.toNode===a.fromNode)return!0;return!1};
T.prototype.isVisible=function(){if(!V.prototype.isVisible.call(this))return!1;var a=this.containingGroup,b=!0,c=this.diagram;null!==c&&(b=c.isTreePathToChildren);c=this.fromNode;if(null!==c){if(this.isTreeLink&&b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(var d=c;null!==d;){if(d.labeledLink===this)return!0;d=d.containingGroup}c=c.findVisibleNode();if(null===c||c===a)return!1}c=this.toNode;if(null!==c){if(this.isTreeLink&&!b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(b=c;null!==b;){if(b.labeledLink===
this)return!0;b=b.containingGroup}b=c.findVisibleNode();if(null===b||b===a)return!1}return!0};T.prototype.Ob=function(a){V.prototype.Ob.call(this,a);null!==this.Mf&&this.Mf.cm();if(null!==this.od)for(var b=this.od.iterator;b.next();)b.value.Ob(a)};T.prototype.computeAdjusting=function(){return this.isAvoiding&&null!==this.diagram&&this.diagram.animationManager.defaultAnimation.isAnimating?Xo:this.uk};
function bp(a){var b=a.We;if(null!==b){var c=a.pf;if(null!==c&&isNaN(a.curviness)){for(var d=a.Xe,e=a.qf,f=a=null,g=b.ab.m,h=g.length,k=0;k<h;k++){var l=g[k];if(l.We===b&&l.Xe===d&&l.pf===c&&l.qf===e||l.We===c&&l.Xe===e&&l.pf===b&&l.qf===d)null===f?f=l:(null===a&&(a=[],a.push(f)),a.push(l))}if(null!==a){f=Ho(b,c,d,e);null===f&&(f=new Dp(b,d,c,e),Go(b,f),Go(c,f));f.links=a;for(b=0;b<a.length;b++)a[b].Mf=f;f.cm()}}}}
function cp(a){var b=a.Mf;null!==b&&isNaN(a.curviness)&&(a.Mf=null,a=b.links.indexOf(a),0<=a&&(Fa(b.links,a),b.cm()))}T.prototype.Hh=function(){return!0};
na.Object.defineProperties(T.prototype,{fromNode:{get:function(){return this.We},set:function(a){var b=this.We;if(b!==a){var c=this.fromPort;null!==b&&(this.pf!==b&&Lo(b,this,c),cp(this),this.B(2));this.We=a;null!==a&&this.Ob(a.isVisible());this.Qf=null;this.Va();var d=this.diagram;null!==d&&d.Z&&d.partManager.setFromNodeForLink(this,a,b);var e=this.fromPort,f=this.fromPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.Z,d.Z=!0);f(this,c,e);null!==d&&(d.Z=g)}null!==a&&
(this.pf!==a&&Ko(a,this,e),bp(this),this.B(1));this.g("fromNode",b,a);Eo(this)}}},fromPortId:{get:function(){return this.Xe},set:function(a){var b=this.Xe;if(b!==a){var c=this.fromPort;null!==c&&Io(c);cp(this);this.Xe=a;var d=this.fromPort;null!==d&&Io(d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.Pi()&&g.Hv(f,a)}c!==d&&(this.Qf=null,this.Va(),f=this.fromPortChanged,null!==f&&(g=!0,null!==e&&(g=e.Z,e.Z=!0),f(this,c,d),null!==e&&(e.Z=g)));bp(this);
this.g("fromPortId",b,a)}}},fromPort:{get:function(){var a=this.We;return null===a?null:a.rs(this.Xe)}},fromPortChanged:{get:function(){return this.Cn},set:function(a){var b=this.Cn;b!==a&&(this.Cn=a,this.g("fromPortChanged",b,a))}},toNode:{get:function(){return this.pf},set:function(a){var b=this.pf;if(b!==a){var c=this.toPort;null!==b&&(this.We!==b&&Lo(b,this,c),cp(this),this.B(2));this.pf=a;null!==a&&this.Ob(a.isVisible());
this.Qf=null;this.Va();var d=this.diagram;null!==d&&d.Z&&d.partManager.setToNodeForLink(this,a,b);var e=this.toPort,f=this.toPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.Z,d.Z=!0);f(this,c,e);null!==d&&(d.Z=g)}null!==a&&(this.We!==a&&Ko(a,this,e),bp(this),this.B(1));this.g("toNode",b,a);Eo(this)}}},toPortId:{get:function(){return this.qf},set:function(a){var b=this.qf;if(b!==a){var c=this.toPort;null!==c&&Io(c);cp(this);this.qf=a;var d=this.toPort;null!==d&&Io(d);
var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.Pi()&&g.Lv(f,a)}c!==d&&(this.Qf=null,this.Va(),f=this.toPortChanged,null!==f&&(g=!0,null!==e&&(g=e.Z,e.Z=!0),f(this,c,d),null!==e&&(e.Z=g)));bp(this);this.g("toPortId",b,a)}}},toPort:{get:function(){var a=this.pf;return null===a?null:a.rs(this.qf)}},toPortChanged:{get:function(){return this.Cp},set:function(a){var b=this.Cp;b!==a&&(this.Cp=a,this.g("toPortChanged",b,a))}},
fromSpot:{get:function(){return null!==this.P?this.P.Og:Tc},set:function(a){this.Lc();var b=this.P.Og;b.A(a)||(a=a.I(),this.P.Og=a,this.g("fromSpot",b,a),(b.Oc()||a.Oc())&&null!==this.fromNode&&Io(this.fromPort),this.Va())}},fromEndSegmentLength:{get:function(){return null!==this.P?this.P.Mg:NaN},set:function(a){this.Lc();var b=this.P.Mg;b!==a&&(0>a&&xa(a,">= 0",T,"fromEndSegmentLength"),this.P.Mg=a,this.g("fromEndSegmentLength",b,a),this.Va())}},
fromShortLength:{get:function(){return null!==this.P?this.P.Ng:NaN},set:function(a){this.Lc();var b=this.P.Ng;b!==a&&(this.P.Ng=a,this.fc(!0),this.g("fromShortLength",b,a))}},toSpot:{get:function(){return null!==this.P?this.P.th:Tc},set:function(a){this.Lc();var b=this.P.th;b.A(a)||(a=a.I(),this.P.th=a,this.g("toSpot",b,a),(b.Oc()||a.Oc())&&null!==this.toNode&&Io(this.toPort),this.Va())}},toEndSegmentLength:{
get:function(){return null!==this.P?this.P.rh:NaN},set:function(a){this.Lc();var b=this.P.rh;b!==a&&(0>a&&xa(a,">= 0",T,"toEndSegmentLength"),this.P.rh=a,this.g("toEndSegmentLength",b,a),this.Va())}},toShortLength:{get:function(){return null!==this.P?this.P.sh:NaN},set:function(a){this.Lc();var b=this.P.sh;b!==a&&(this.P.sh=a,this.fc(!0),this.g("toShortLength",b,a))}},isLabeledLink:{get:function(){return null===this.od?!1:0<this.od.count}},
labelNodes:{get:function(){return null===this.od?$a:this.od.iterator}},relinkableFrom:{get:function(){return 0!==(this.Ia&1)},set:function(a){var b=0!==(this.Ia&1);b!==a&&(this.Ia^=1,this.g("relinkableFrom",b,a),this.Lb())}},relinkableTo:{get:function(){return 0!==(this.Ia&2)},set:function(a){var b=0!==(this.Ia&2);b!==a&&(this.Ia^=2,this.g("relinkableTo",b,a),this.Lb())}},resegmentable:{
get:function(){return 0!==(this.Ia&4)},set:function(a){var b=0!==(this.Ia&4);b!==a&&(this.Ia^=4,this.g("resegmentable",b,a),this.Lb())}},isTreeLink:{get:function(){return 0!==(this.Ia&8)},set:function(a){var b=0!==(this.Ia&8);b!==a&&(this.Ia^=8,this.g("isTreeLink",b,a),null!==this.fromNode&&vk(this.fromNode),null!==this.toNode&&vk(this.toNode))}},path:{get:function(){var a=this.pb();return a instanceof xf?a:null}},routeBounds:{
get:function(){this.ug();var a=this.wl,b=Infinity,c=Infinity,d=this.pointsCount;if(0===d)a.h(NaN,NaN,0,0);else{if(1===d)d=this.i(0),b=Math.min(d.x,b),c=Math.min(d.y,c),a.h(d.x,d.y,0,0);else if(2===d){d=this.i(0);var e=this.i(1);b=Math.min(d.x,e.x);c=Math.min(d.y,e.y);a.h(d.x,d.y,0,0);a.Oe(e)}else if(this.computeCurve()===Uf&&3<=d&&!this.isOrthogonal)if(e=this.i(0),b=e.x,c=e.y,a.h(b,c,0,0),3===d){d=this.i(1);b=Math.min(d.x,b);c=Math.min(d.y,c);var f=this.i(2);b=Math.min(f.x,b);c=Math.min(f.y,
c);L.Tl(e.x,e.y,d.x,d.y,d.x,d.y,f.x,f.y,.5,a)}else for(f=3;f<d;f+=3){var g=this.i(f-2);f+3>=d&&(f=d-1);var h=this.i(f-1),k=this.i(f);L.Tl(e.x,e.y,g.x,g.y,h.x,h.y,k.x,k.y,.5,a);b=Math.min(k.x,b);c=Math.min(k.y,c);e=k}else for(e=this.i(0),f=this.i(1),b=Math.min(e.x,f.x),c=Math.min(e.y,f.y),a.h(e.x,e.y,0,0),a.Oe(f),e=2;e<d;e++)f=this.i(e),b=Math.min(f.x,b),c=Math.min(f.y,c),a.Oe(f);this.lu.h(b-a.x,c-a.y)}return a}},midPoint:{get:function(){this.ug();return this.computeMidPoint(new J)}},
midAngle:{get:function(){this.ug();return this.computeMidAngle()}},flattenedLengths:{get:function(){if(null===this.cr){this.ud||dp(this);for(var a=this.cr=[],b=this.pointsCount,c=0;c<b-1;c++){var d=this.i(c);var e=this.i(c+1);L.aa(d.x,e.x)?(d=e.y-d.y,0>d&&(d=-d)):L.aa(d.y,e.y)?(d=e.x-d.x,0>d&&(d=-d)):d=Math.sqrt(d.xf(e));a.push(d)}}return this.cr}},flattenedTotalLength:{get:function(){var a=this.Gt;if(isNaN(a)){for(var b=
this.flattenedLengths,c=b.length,d=a=0;d<c;d++)a+=b[d];this.Gt=a}return a}},points:{get:function(){return this.Cb},set:function(a){var b=this.Cb;if(b!==a){var c=null;if(Array.isArray(a)){var d=0===a.length%2;if(d)for(var e=0;e<a.length;e++)if("number"!==typeof a[e]||isNaN(a[e])){d=!1;break}if(d)for(c=new F,d=0;d<a.length/2;d++)e=(new J(a[2*d],a[2*d+1])).freeze(),c.add(e);else{d=!0;for(e=0;e<a.length;e++){var f=a[e];if(!za(f)||"number"!==typeof f.x||isNaN(f.x)||"number"!==
typeof f.y||isNaN(f.y)){d=!1;break}}if(d)for(c=new F,d=0;d<a.length;d++)e=a[d],c.add((new J(e.x,e.y)).freeze())}}else if(a instanceof F)for(c=a.copy(),a=c.iterator;a.next();)a.value.freeze();else C("Link.points value is not an instance of List or Array: "+a);c.freeze();this.Cb=c;this.fc(!0);dp(this);a=this.diagram;null!==a&&(a.Oi||a.undoManager.isUndoingRedoing||a.Gs.add(this),a.animationManager.tb&&(a=a.animationManager,this.gf=c,a.yl.add(this)));this.g("points",b,c)}}},pointsCount:{
get:function(){return this.Cb.count}},ud:{get:function(){return 0!==(this.Ia&16)},set:function(a){0!==(this.Ia&16)!==a&&(this.Ia^=16)}},suspendsRouting:{get:function(){return 0!==(this.Ia&32)},set:function(a){0!==(this.Ia&32)!==a&&(this.Ia^=32)}},computingPoints:{get:function(){return 0!==(this.Ia&64)},set:function(a){0!==(this.Ia&64)!==a&&(this.Ia^=64)}},defaultFromPoint:{
get:function(){return this.o},set:function(a){this.o=a.copy()}},defaultToPoint:{get:function(){return this.D},set:function(a){this.D=a.copy()}},isOrthogonal:{get:function(){return 2===(this.Cj.value&2)}},isAvoiding:{get:function(){return 4===(this.Cj.value&4)}},Bm:{get:function(){return 0!==(this.Ia&128)},set:function(a){0!==(this.Ia&128)!==a&&(this.Ia^=128)}},geometry:{
get:function(){this.Bm||(this.ug(),this.ma=this.makeGeometry());return this.ma}},firstPickIndex:{get:function(){return 2>=this.pointsCount?0:this.isOrthogonal||!hp(this.computeSpot(!0))?1:0}},lastPickIndex:{get:function(){var a=this.pointsCount;return 0===a?0:2>=a?a-1:this.isOrthogonal||!hp(this.computeSpot(!1))?a-2:a-1}},adjusting:{get:function(){return this.uk},set:function(a){var b=this.uk;b!==
a&&(this.uk=a,this.g("adjusting",b,a))}},corner:{get:function(){return this.fn},set:function(a){var b=this.fn;b!==a&&(this.fn=a,this.fc(!0),this.g("corner",b,a))}},curve:{get:function(){return this.hn},set:function(a){var b=this.hn;b!==a&&(this.hn=a,this.Va(),this.fc(!0),ep(this,b===Qf||b===Pf||a===Qf||a===Pf),this.g("curve",b,a))}},curviness:{get:function(){return this.jn},set:function(a){var b=this.jn;b!==
a&&(this.jn=a,this.Va(),this.fc(!1),this.g("curviness",b,a))}},routing:{get:function(){return this.Cj},set:function(a){var b=this.Cj;b!==a&&(this.Cj=a,this.Qf=null,this.Va(),ep(this,2===(b.value&2)||2===(a.value&2)),this.g("routing",b,a))}},smoothness:{get:function(){return this.qp},set:function(a){var b=this.qp;b!==a&&(this.qp=a,this.fc(!0),this.g("smoothness",b,a))}},key:{get:function(){var a=this.diagram;
if(null!==a&&a.model.Pi())return a.model.pc(this.data)}}});T.prototype.invalidateOtherJumpOvers=T.prototype.eq;T.prototype.findClosestSegment=T.prototype.Dz;T.prototype.updateRoute=T.prototype.ug;T.prototype.invalidateRoute=T.prototype.Va;T.prototype.rollbackRoute=T.prototype.Cv;T.prototype.commitRoute=T.prototype.vf;T.prototype.startRoute=T.prototype.Lh;T.prototype.clearPoints=T.prototype.Pj;T.prototype.removePoint=T.prototype.Av;T.prototype.addPointAt=T.prototype.tf;T.prototype.addPoint=T.prototype.ee;
T.prototype.insertPointAt=T.prototype.l;T.prototype.insertPoint=T.prototype.iA;T.prototype.setPointAt=T.prototype.M;T.prototype.setPoint=T.prototype.Qc;T.prototype.getPoint=T.prototype.i;T.prototype.getOtherPort=T.prototype.$z;T.prototype.getOtherNode=T.prototype.$p;
var fp=null,gp=null,Wo=new D(T,"Normal",1),Ep=new D(T,"Orthogonal",2),Fp=new D(T,"AvoidsNodes",6),np=new D(T,"AvoidsNodesStraight",7),Rf=new D(T,"None",0),Uf=new D(T,"Bezier",9),Qf=new D(T,"JumpGap",10),Pf=new D(T,"JumpOver",11),Xo=new D(T,"End",17),Yo=new D(T,"Scale",18),Zo=new D(T,"Stretch",19),Lm=new D(T,"OrientAlong",21),Em=new D(T,"OrientPlus90",22),Gm=new D(T,"OrientMinus90",23),$o=new D(T,"OrientOpposite",24),Mm=new D(T,"OrientUpright",25),Fm=new D(T,"OrientPlus90Upright",26),Hm=new D(T,"OrientMinus90Upright",
27),Im=new D(T,"OrientUpright45",28),pp=16,op=14,qp=8;T.className="Link";T.Normal=Wo;T.Orthogonal=Ep;T.AvoidsNodes=Fp;T.AvoidsNodesStraight=np;T.None=Rf;T.Bezier=Uf;T.JumpGap=Qf;T.JumpOver=Pf;T.End=Xo;T.Scale=Yo;T.Stretch=Zo;T.OrientAlong=Lm;T.OrientPlus90=Em;T.OrientMinus90=Gm;T.OrientOpposite=$o;T.OrientUpright=Mm;T.OrientPlus90Upright=Fm;T.OrientMinus90Upright=Hm;T.OrientUpright45=Im;T.EndSegmentStep=8;T.CurvinessStart=pp;T.SpacingMin=op;T.OrthoShortCut=qp;T.AvoidanceCell=8;T.AvoidanceLimit=999;
function Dp(a,b,c,d){Ua(this);this.ue=this.ir=!1;this.Js=a;this.my=b;this.nv=c;this.ny=d;this.links=[]}Dp.prototype.cm=function(){if(!this.ir){var a=this.links;0<a.length&&(a=a[0].diagram,null!==a&&(a.Ow.add(this),this.ue=a.undoManager.isUndoingRedoing))}this.ir=!0};
Dp.prototype.Xv=function(){if(this.ir){this.ir=!1;var a=this.links;if(0<a.length){var b=a[0],c=b.diagram;c=null===c||c.Oi&&!this.ue;this.ue=!1;b.arrangeBundledLinks(a,c);1===a.length&&(b.Mf=null,a.length=0)}0===a.length&&(a=this.Js,null!==this&&null!==a.Te&&a.Te.remove(this),a=this.nv,null!==this&&null!==a.Te&&a.Te.remove(this))}};Dp.className="LinkBundle";
function jk(){Ua(this);this.yy=this.group=null;this.zs=!0;this.abort=!1;this.Ad=this.zd=1;this.po=this.oo=-1;this.hc=this.gc=8;this.Tb=null;this.zi=this.yi=0;this.zy=11;this.ey=124}
jk.prototype.initialize=function(a){if(!(0>=a.width||0>=a.height)){var b=a.y,c=a.x+a.width,d=a.y+a.height;this.zd=Math.floor((a.x-this.gc)/this.gc)*this.gc;this.Ad=Math.floor((b-this.hc)/this.hc)*this.hc;this.oo=Math.ceil((c+2*this.gc)/this.gc)*this.gc;this.po=Math.ceil((d+2*this.hc)/this.hc)*this.hc;a=1+(Math.ceil((this.oo-this.zd)/this.gc)|0);b=1+(Math.ceil((this.po-this.Ad)/this.hc)|0);if(null===this.Tb||this.yi<a-1||this.zi<b-1){c=[];for(d=0;d<=a;d++)c[d]=new Uint32Array(b);this.Tb=c;this.yi=
a-1;this.zi=b-1}a=Gp;if(null!==this.Tb)for(b=0;b<=this.yi;b++)if(c=this.Tb[b],c.fill)c.fill(a);else for(d=0;d<=this.zi;d++)c[d]=a}};function nk(a,b,c){return a.zd<=b&&b<=a.oo&&a.Ad<=c&&c<=a.po}function sp(a,b,c){if(!nk(a,b,c))return Gp;b-=a.zd;b/=a.gc;c-=a.Ad;c/=a.hc;return a.Tb[b|0][c|0]}function mk(a){if(null!==a.Tb)for(var b=0;b<=a.yi;b++)for(var c=a.Tb[b],d=0;d<=a.zi;d++)c[d]>=vp&&(c[d]=Gp)}
jk.prototype.dk=function(a,b,c,d){if(a>this.oo||a+c<this.zd||b>this.po||b+d<this.Ad)return!0;a=(a-this.zd)/this.gc|0;b=(b-this.Ad)/this.hc|0;c=Math.max(0,c)/this.gc+1|0;var e=Math.max(0,d)/this.hc+1|0;0>a&&(c+=a,a=0);0>b&&(e+=b,b=0);if(0>c||0>e)return!0;d=Math.min(a+c-1,this.yi)|0;for(c=Math.min(b+e-1,this.zi)|0;a<=d;a++){e=this.Tb[a];for(var f=b;f<=c;f++)if(e[f]===ok)return!1}return!0};
function Hp(a,b,c,d,e,f,g,h,k){if(!(b<f||b>g||c<h||c>k)){var l=b|0;var m=c|0;var n=a.Tb[l][m];if(n>=vp&&n<tp)for(e?m+=d:l+=d,n+=1;f<=l&&l<=g&&h<=m&&m<=k&&!(n>=a.Tb[l][m]);)a.Tb[l][m]=n,n+=1,e?m+=d:l+=d;l=e?m:l;if(e)if(0<d)for(c+=d;c<l;c+=d)Hp(a,b,c,1,!e,f,g,h,k),Hp(a,b,c,-1,!e,f,g,h,k);else for(c+=d;c>l;c+=d)Hp(a,b,c,1,!e,f,g,h,k),Hp(a,b,c,-1,!e,f,g,h,k);else if(0<d)for(b+=d;b<l;b+=d)Hp(a,b,c,1,!e,f,g,h,k),Hp(a,b,c,-1,!e,f,g,h,k);else for(b+=d;b>l;b+=d)Hp(a,b,c,1,!e,f,g,h,k),Hp(a,b,c,-1,!e,f,g,h,
k)}}function Ip(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=ok,m=vp;for(a.Tb[b][c]=m;l===ok&&b>f&&b<g&&c>h&&c<k;)m+=1,a.Tb[b][c]=m,e?c+=d:b+=d,l=a.Tb[b][c]}function Jp(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=ok,m=tp;for(a.Tb[b][c]=m;l===ok&&b>f&&b<g&&c>h&&c<k;)a.Tb[b][c]=m,e?c+=d:b+=d,l=a.Tb[b][c]}
function rp(a,b,c,d,e,f,g){if(null!==a.Tb){a.abort=!1;var h=b.x,k=b.y;if(nk(a,h,k)){h-=a.zd;h/=a.gc;k-=a.Ad;k/=a.hc;var l=d.x,m=d.y;if(nk(a,l,m))if(l-=a.zd,l/=a.gc,m-=a.Ad,m/=a.hc,1>=Math.abs(h-l)&&1>=Math.abs(k-m))a.abort=!0;else{var n=f.x;d=f.y;b=f.x+f.width;var p=f.y+f.height;n-=a.zd;n/=a.gc;d-=a.Ad;d/=a.hc;b-=a.zd;b/=a.gc;p-=a.Ad;p/=a.hc;f=Math.max(0,Math.min(a.yi,n|0));b=Math.min(a.yi,Math.max(0,b|0));n=Math.max(0,Math.min(a.zi,d|0));p=Math.min(a.zi,Math.max(0,p|0));d=a.Tb;h|=0;k|=0;l|=0;m|=
0;var r=0===c||90===c?1:-1;c=90===c||270===c;d[h][k]===ok?(Ip(a,h,k,r,c,f,b,n,p),Ip(a,h,k,1,!c,f,b,n,p),Ip(a,h,k,-1,!c,f,b,n,p)):Ip(a,h,k,r,c,h,k,h,k);d[l][m]===ok?(Jp(a,l,m,0===e||90===e?1:-1,90===e||270===e,f,b,n,p),Jp(a,l,m,1,!(90===e||270===e),f,b,n,p),Jp(a,l,m,-1,!(90===e||270===e),f,b,n,p)):Jp(a,l,m,r,c,l,m,l,m);c=Ga();if(g&&Kp(a,l,m,e,h,k,c)){if(c[0]!==l||c[1]!==m)c.unshift(m),c.unshift(l);if(c[c.length-2]!==h||c[c.length-1]!==k)c.push(h),c.push(k);a=vp;e=c[c.length-2];g=c[c.length-1];d[e][g]=
a++;for(f=c.length-4;0<=f;f-=2)for(e=c[f+2],g=c[f+3],b=c[f],l=c[f+1];b>e?e++:b<e?e--:l>g?g++:l<g&&g--,d[e][g]=a++,e!==b||g!==l;);}else Hp(a,h,k,1,!1,f,b,n,p),Hp(a,h,k,-1,!1,f,b,n,p),Hp(a,h,k,1,!0,f,b,n,p),Hp(a,h,k,-1,!0,f,b,n,p);Ja(c)}}}}
function Kp(a,b,c,d,e,f,g){for(var h=a.Tb,k=b,l=c;;){if(k===e&&l===f)return!0;var m=k,n=l;if(0===d)if(m<e)m++;else break;else if(90===d)if(n<f)n++;else break;else if(180===d)if(m>e)m--;else break;else if(n>f)n--;else break;var p=h[m][n];if(0===p||p===Lp)break;k=m;l=n}for(;;){m=d;n=k;p=l;0===d?p<f?(m=90,p++):p>f&&(m=270,p--):90===d?n<e?(m=0,n++):n>e&&(m=180,n--):180===d?p<f?(m=90,p++):p>f&&(m=270,p--):n<e?(m=0,n++):n>e&&(m=180,n--);n=h[n][p];if(m!==d&&0!==n&&n!==Lp){g.push(k);g.push(l);if(Kp(a,k,l,
m,e,f,g))return!0;g.pop();g.pop()}h[k][l]=Lp;if(0===d){if(k===b)return!1;k--}else if(90===d){if(l===c)return!1;l--}else if(180===d){if(k===b)return!1;k++}else{if(l===c)return!1;l++}}}
na.Object.defineProperties(jk.prototype,{bounds:{get:function(){return new M(this.zd,this.Ad,this.oo-this.zd,this.po-this.Ad)}},Qp:{get:function(){return this.gc},set:function(a){0<a&&a!==this.gc&&(this.gc=a,this.initialize(this.bounds))}},Pp:{get:function(){return this.hc},set:function(a){0<a&&a!==this.hc&&(this.hc=a,this.initialize(this.bounds))}}});var ok=0,vp=1,tp=999999,Gp=tp+1,Lp=tp+2;jk.className="PositionArray";
function lp(){Ua(this);this.port=this.node=null;this.ge=[];this.hq=!1}lp.prototype.toString=function(){for(var a=this.ge,b=this.node.toString()+" "+a.length.toString()+":",c=0;c<a.length;c++){var d=a[c];null!==d&&(b+="\n  "+d.toString())}return b};
function Mp(a,b,c,d){b=b.offsetY;switch(b){case 8:return 90;case 2:return 180;case 1:return 270;case 4:return 0}switch(b){case 9:return 180<c?270:90;case 6:return 90<c&&270>=c?180:0}a=180*Math.atan2(a.height,a.width)/Math.PI;switch(b){case 3:return c>a&&c<=180+a?180:270;case 5:return c>180-a&&c<=360-a?270:0;case 12:return c>a&&c<=180+a?90:0;case 10:return c>180-a&&c<=360-a?180:90;case 7:return 90<c&&c<=180+a?180:c>180+a&&c<=360-a?270:0;case 13:return 180<c&&c<=360-a?270:c>a&&180>=c?90:0;case 14:return c>
a&&c<=180-a?90:c>180-a&&270>=c?180:0;case 11:return c>180-a&&c<=180+a?180:c>180+a?270:90}d&&15!==b&&(c-=15,0>c&&(c+=360));return c>a&&c<180-a?90:c>=180-a&&c<=180+a?180:c>180+a&&c<360-a?270:0}lp.prototype.cm=function(){this.ge.length=0};
function mp(a,b){var c=a.ge;if(0===c.length){a:if(!a.hq){c=a.hq;a.hq=!0;var d=null,e=a.node,f=e instanceof U?e:null;if(null===f||f.isSubGraphExpanded)var g=e.isTreeExpanded?e.findLinksConnected(a.port.portId):e.Mx();else{if(!f.actualBounds.u()){a.hq=c;break a}d=f;g=d.Mu()}f=a.ge.length=0;var h=a.port.da(tc,J.alloc()),k=a.port.da(Bc,J.alloc());e=M.allocAt(h.x,h.y,0,0);e.Oe(k);J.free(h);J.free(k);h=J.allocAt(e.x+e.width/2,e.y+e.height/2);k=a.port.Ki();for(g=g.iterator;g.next();){var l=g.value;if(l.isVisible()&&
l.fromPort!==l.toPort){var m=l.fromPort===a.port||null!==l.fromNode&&l.fromNode.Jd(d),n=l.computeSpot(m,a.port);if(n.Oc()){var p=m?l.toPort:l.fromPort;if(null!==p&&(m=p.part,null!==m)){var r=m.findVisibleNode();null!==r&&r!==m&&(m=r,p=m.port);m=l.computeOtherPoint(m,p);p=h.Pa(p.da(xc));p+=(h.Pa(m)-p)/360;p-=k;0>p?p+=360:360<=p&&(p-=360);n=Mp(e,n,p,l.isOrthogonal);0===n?(n=4,180<p&&(p-=360)):90===n?(n=8,270<p&&(p-=360)):180===n?n=2:(n=1,90>p&&(p+=360));r=a.ge[f];void 0===r?(r=new Np(l,p,n),a.ge[f]=
r):(r.link=l,r.angle=p,r.Bc=n);r.qv.set(m);f++}}}}J.free(h);a.ge.sort(lp.prototype.j);k=a.ge.length;d=-1;for(f=h=0;f<k;f++)g=a.ge[f],void 0!==g&&(g.Bc!==d&&(d=g.Bc,h=0),g.aq=h,h++);d=-1;h=0;for(f=k-1;0<=f;f--)k=a.ge[f],void 0!==k&&(k.Bc!==d&&(d=k.Bc,h=k.aq+1),k.Wl=h);f=a.ge;n=a.port;d=a.node.portSpreading;h=J.alloc();k=J.alloc();g=J.alloc();l=J.alloc();n.da(tc,h);n.da(vc,k);n.da(Bc,g);n.da(zc,l);r=p=m=n=0;if(d===To)for(var q=0;q<f.length;q++){var u=f[q];if(null!==u){var w=u.link.computeThickness();
switch(u.Bc){case 8:p+=w;break;case 2:r+=w;break;case 1:n+=w;break;default:case 4:m+=w}}}var v=q=0,A=1,y=u=0;for(w=0;w<f.length;w++){var B=f[w];if(null!==B){if(q!==B.Bc){q=B.Bc;switch(q){case 8:var z=g;v=l;break;case 2:z=l;v=h;break;case 1:z=h;v=k;break;default:case 4:z=k,v=g}u=v.x-z.x;y=v.y-z.y;switch(q){case 8:p>Math.abs(u)?(A=Math.abs(u)/p,p=Math.abs(u)):A=1;break;case 2:r>Math.abs(y)?(A=Math.abs(y)/r,r=Math.abs(y)):A=1;break;case 1:n>Math.abs(u)?(A=Math.abs(u)/n,n=Math.abs(u)):A=1;break;default:case 4:m>
Math.abs(y)?(A=Math.abs(y)/m,m=Math.abs(y)):A=1}v=0}var E=B.gq;if(d===To){B=B.link.computeThickness();B*=A;E.set(z);switch(q){case 8:E.x=z.x+u/2+p/2-v-B/2;break;case 2:E.y=z.y+y/2+r/2-v-B/2;break;case 1:E.x=z.x+u/2-n/2+v+B/2;break;default:case 4:E.y=z.y+y/2-m/2+v+B/2}v+=B}else{var K=.5;d===Fo&&(K=(B.aq+1)/(B.Wl+1));E.x=z.x+u*K;E.y=z.y+y*K}}}J.free(h);J.free(k);J.free(g);J.free(l);z=a.ge;for(f=0;f<z.length;f++)d=z[f],null!==d&&(d.Ju=a.computeEndSegmentLength(d));a.hq=c;M.free(e)}c=a.ge}for(a=0;a<c.length;a++)if(e=
c[a],null!==e&&e.link===b)return e;return null}lp.prototype.j=function(a,b){return a===b?0:null===a?-1:null===b?1:a.Bc<b.Bc?-1:a.Bc>b.Bc?1:a.angle<b.angle?-1:a.angle>b.angle?1:0};
lp.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.node,this.port,qc,b.fromPort===this.port),d=a.aq;if(0>d)return c;var e=a.Wl;if(1>=e||!b.isOrthogonal)return c;b=a.qv;var f=a.gq;if(2===a.Bc||8===a.Bc)d=e-1-d;return((a=2===a.Bc||4===a.Bc)?b.y<f.y:b.x<f.x)?c+8*d:(a?b.y===f.y:b.x===f.x)?c:c+8*(e-1-d)};lp.className="Knot";function Np(a,b,c){this.link=a;this.angle=b;this.Bc=c;this.qv=new J;this.Wl=this.aq=0;this.gq=new J;this.Ju=0}
Np.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.Bc.toString()+":"+this.aq.toString()+"/"+this.Wl.toString()+" "+this.gq.toString()+" "+this.Ju.toString()+" "+this.qv.toString()};Np.className="LinkInfo";function Xk(){this.th=this.Og=Tc;this.sh=this.Ng=this.rh=this.Mg=NaN;this.Ap=this.An=null;this.Bp=this.Bn=Infinity}
Xk.prototype.copy=function(){var a=new Xk;a.Og=this.Og.I();a.th=this.th.I();a.Mg=this.Mg;a.rh=this.rh;a.Ng=this.Ng;a.sh=this.sh;a.An=this.An;a.Ap=this.Ap;a.Bn=this.Bn;a.Bp=this.Bp;return a};Xk.className="LinkSettings";function mi(a){Ua(this);this.o=this.C=null;this.$h=this.Un=!0;this.$n=!1;this.Qm=(new J(0,0)).freeze();this.Xn=!0;this.Um=this.Wn=null;this.Zn=!1;this.j=null;this.D=0;this.qo=this.Hp=null;this.gs=!1;this.kg=this.Ej=null;this.Xr=!1;a&&Object.assign(this,a)}
mi.prototype.cloneProtected=function(a){a.Un=this.Un;a.$h=this.$h;a.$n=this.$n;a.Qm.assign(this.Qm);a.Xn=this.Xn;a.Wn=this.Wn;a.Um=this.Um;a.Zn=!0;a.qo=this.qo;a.Hp=this.Hp};mi.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};mi.prototype.serializeLayoutProperties=function(a){a.arrangementOrigin={x:this.arrangementOrigin.x,y:this.arrangementOrigin.y};a.isRouting=this.isRouting};
mi.prototype.deserializeLayoutProperties=function(a){null!==a&&(this.arrangementOrigin=new J(a.arrangementOrigin.x,a.arrangementOrigin.y),this.isRouting=a.isRouting)};mi.prototype.gb=function(){};mi.prototype.toString=function(){var a=Ka(this.constructor);a+="(";null!==this.group&&(a+=" in "+this.group);null!==this.diagram&&(a+=" for "+this.diagram);return a+")"};
mi.prototype.B=function(){if(this.isValidLayout){var a=this.diagram;if(null!==a&&!a.undoManager.isUndoingRedoing){var b=a.animationManager;!b.isTicking&&(b.defaultAnimation.isAnimating&&b.qc(),this.isOngoing&&a.Oi||this.isInitial&&!a.Oi)&&(this.isValidLayout=!1,a.Fb())}}};mi.prototype.createNetwork=function(){return new Op(this)};mi.prototype.makeNetwork=function(a){var b=this.createNetwork();a instanceof R?(b.mg(a.nodes,!0),b.mg(a.links,!0)):a instanceof U?b.mg(a.memberParts):b.mg(a.iterator);return b};
mi.prototype.updateParts=function(){this.isValidLayout=!0;if(!this.workerLayout()){var a=this.diagram;if(null===a&&null!==this.network)for(var b=this.network.vertexes.iterator;b.next();){var c=b.value.node;if(null!==c&&(a=c.diagram,null!==a))break}try{null!==a&&a.xa("Layout"),this.commitLayout()}finally{null!==a&&a.Xa("Layout")}}};mi.prototype.commitLayout=function(){if(null!==this.network){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();if(this.isRouting)for(a=this.network.edges.iterator;a.next();)a.value.commit()}};
mi.prototype.doLayout=function(a){var b=new G;a instanceof R?(Pp(this,b,a.nodes,!0,this.Jh,!0,!1,!0),Pp(this,b,a.parts,!0,this.Jh,!0,!1,!0)):a instanceof U?Pp(this,b,a.memberParts,!1,this.Jh,!0,!1,!0):b.addAll(a.iterator);0<b.count&&(a=this.diagram,null!==a&&a.xa("Layout"),this.doMinimalNoNetworkLayout(b),null!==a&&a.Xa("Layout"));this.isValidLayout=!0};
mi.prototype.doMinimalNoNetworkLayout=function(a){var b=Math.ceil(Math.sqrt(a.count));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var c=this.arrangementOrigin.x,d=c,e=this.arrangementOrigin.y,f=0,g=0;for(a=a.iterator;a.next();){var h=a.value;Qp(h);var k=h.measuredBounds,l=k.width;k=k.height;h.moveTo(d,e);h instanceof U&&(h.Jh=!1);d+=Math.max(l,50)+20;g=Math.max(g,Math.max(k,50));f>=b-1?(f=0,d=c,e+=g+20,g=0):f++}};
mi.prototype.doMinimalNetworkLayout=function(){var a=Math.ceil(Math.sqrt(this.network.vertexes.count));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);for(var b=this.arrangementOrigin.x,c=b,d=this.arrangementOrigin.y,e=0,f=0,g=this.network.vertexes.iterator;g.next();){var h=g.value.node;if(!(null===h||h instanceof T)&&(Qp(h),this.Jh(h))){var k=h.measuredBounds,l=k.width;k=k.height;h.moveTo(c,d);h instanceof U&&(h.Jh=!1);c+=Math.max(l,50)+20;f=Math.max(f,Math.max(k,50));e>=a-1?(e=
0,c=b,d+=f+20,f=0):e++}}};mi.prototype.Jh=function(a){return!a.location.u()||a instanceof U&&a.Jh?!0:!1};function Pp(a,b,c,d,e,f,g,h){for(c=c.iterator;c.next();){var k=c.value;d&&!k.isTopLevel||null!==e&&!e(k)||!k.canLayout()||(f&&k instanceof W?k.isLinkLabel||(k instanceof U?null===k.layout?Pp(a,b,k.memberParts,!1,e,f,g,h):(Qp(k),b.add(k)):(Qp(k),b.add(k))):g&&k instanceof T?b.add(k):!h||!k.Nc()||k instanceof W||(Qp(k),b.add(k)))}}
function Qp(a){var b=a.actualBounds;(0===b.width||0===b.height||isNaN(b.width)||isNaN(b.height))&&a.Ta()}mi.prototype.Mi=function(a,b){var c=this.boundsComputation;if(null!==c)return b||(b=new M),c(a,this,b);if(!b)return a.actualBounds;b.set(a.actualBounds);return b};
mi.prototype.Ax=function(a){var b=new G;a instanceof R?(Pp(this,b,a.nodes,!0,null,!0,!0,!0),Pp(this,b,a.links,!0,null,!0,!0,!0),Pp(this,b,a.parts,!0,null,!0,!0,!0)):a instanceof U?Pp(this,b,a.memberParts,!1,null,!0,!0,!0):Pp(this,b,a.iterator,!1,null,!0,!0,!0);return b};
mi.prototype.initialOrigin=function(a){var b=this.group;if(null!==b){var c=b.position.copy();(isNaN(c.x)||isNaN(c.y))&&c.set(a);b=b.placeholder;null!==b&&(c=b.da(tc),(isNaN(c.x)||isNaN(c.y))&&c.set(a),a=b.padding,c.x+=a.left,c.y+=a.top);return c}return a};mi.prototype.mayUseWorker=function(){return this.mayUseWorkerFunction?this.mayUseWorkerFunction(this):!1};mi.prototype.workerLayout=function(){return!1};
function Rp(a,b){if(null!==a.workerStateChanged){var c={key:a.group?a.group.key:null};void 0!==b&&(c.time=b);null!==a.Ej&&(c.running=Sp(a.Ej));null!==a.kg&&(c.waiting=Sp(a.kg));a.workerStateChanged(c,a)}}function Sp(a){return{vertexes:a.vertexes.count,edges:a.edges.count}}mi.prototype.jz=function(){var a=Tp(this.constructor);a&&(null!==a.Pe&&a.Pe.terminate(),a.Pe=null,a.em.iteratorValues.each(function(a){a.gs=!1;a.Ej=null;a.kg=null;a.Xr=!1;Rp(a)}),a.em.clear())};
function Up(a,b){var c=Tp(a);if(c){if(b)for(var d in b)c[d]=b[d]}else throw Error("Unknown Layout class: "+a);}function Tp(a){var b=null;if("function"===typeof a){if(b=Vp.get(a),!b){var c=Ka(a);b=Vp.get(c);b||(b=new Wp,b.Eu=a,b.name=c,b.j=a.name,b.Yx=Xp,Vp.set(c,b),Vp.set(a,b),Vp.set(a.name,b))}}else"string"===typeof a&&(b=Vp.get(a));return b}
mi.prototype.Wv=function(){if("undefined"===typeof Worker||!Yp||"undefined"===typeof self||"undefined"!==typeof self.DedicatedWorkerGlobalScope)return!1;if(!this.mayUseWorker())return this.gs&&(this.Xr=!0,this.kg=this.Ej=null,Rp(this)),!1;var a=Tp(this.constructor);if(null===a)return!1;null===a.Pe&&(a.Pe=new Worker(Yp),a.Pe.onerror=function(a){a.preventDefault();ya("Worker Error at: "+a.filename+" "+a.lineno+" "+a.colno+"\n  "+a.message)},a.Pe.j=function(a){ya("Worker serialization error: "+a)},a.Pe.onmessage=
function(b){var c=b.data;if("_GoJS"===c._GoJS)if(c.version&&R.version&&c.version!==R.version)ya("Failure: GoJS v"+R.version+"  Worker v"+c.version);else if(b=a.em.get(c.id)){a.em.remove(c.id);b.gs=!1;b.Ej=null;if(b.Xr)b.Xr=!1,b.kg=null;else{var d=Zp(b,c,!1);b.network=d;b.updateParts();b.network=null;b.isValidLayout=!0}Rp(b,c.time);c=b.kg;if(null!==c)b.kg=null;else for(d=a.em.iteratorValues;d.next();){var e=d.value;c=e.kg;if(null!==c){e.kg=null;break}}null!==c&&$p(b,c)}},a.Pe.postMessage({_GoJS:"_GoJS",
url:a.Yx}),Array.isArray(a.scripts)&&a.scripts.forEach(function(b){a.Pe.postMessage({_GoJS:"_GoJS",url:b})}),a.Pe.postMessage({_GoJS:"_GoJS",version:-1}));null!==this.Ej?this.kg=this.network:$p(this,this.network);Rp(this);this.doMinimalNetworkLayout();this.network=null;return this.isValidLayout=!0};function $p(a,b){a.gs=!0;var c=Tp(a.constructor),d=aq(a,b,!0);d._GoJS="_GoJS";c.Pe.postMessage(d);c.em.set(fb(a),a);a.Ej=b}
function aq(a,b,c){a.onNetworkSerialization(1,c,b,null);var d={};a.serializeLayoutProperties(d,c);var e=[];b.vertexes.each(function(a){var b={};a.serializeVertexProperties(b,c);e.push(b)});var f=[];b.edges.each(function(a){var b={};a.serializeEdgeProperties(b,c);f.push(b)});d={id:c?fb(a):a.id,layout:Ka(a.constructor),p:d,XA:e,Bz:f};a.onNetworkSerialization(2,c,b,d);return d}
function Zp(a,b,c){c&&(a.id=b.id);var d=a.diagram,e=a.createNetwork();a.onNetworkSerialization(3,c,e,b);var f=b.XA,g=new I;f&&f.forEach(function(a){var b=null;null===a.key||null===d||c||(b=d.Eb(a.key));null!==b?b=e.Nj(b):(b=e.createVertex(),e.ng(b));c&&null!==a.key&&(b.data={di:a.key});g.set(a.id,b)});var h=b.Bz,k=new I;h&&h.forEach(function(a){var b=null;null===a.key||null===d||c||(b=d.findLinkForKey(a.key));var f=e.createEdge();e.Rl(f);f.link=b;c&&null!==a.key&&(f.data={di:a.key});k.set(a.id,f)});
f&&f.forEach(function(a){var b=g.get(a.id);b&&b.deserializeVertexProperties(a,g,k,c)});h&&h.forEach(function(a){var b=k.get(a.id);b&&b.deserializeEdgeProperties(a,g,k,c)});a.deserializeLayoutProperties(b.p,g,k,c,e);a.onNetworkSerialization(4,c,e,b);return e}mi.prototype.onNetworkSerialization=function(){};
na.Object.defineProperties(mi.prototype,{diagram:{get:function(){return this.C},set:function(a){this.C=a}},group:{get:function(){return this.o},set:function(a){this.o!==a&&(this.o=a,null!==a&&(this.C=a.diagram))}},isOngoing:{get:function(){return this.Un},set:function(a){this.Un!==a&&(this.Un=a)}},isInitial:{get:function(){return this.$h},set:function(a){this.$h=a;a||(this.Zn=!0)}},
isViewportSized:{get:function(){return this.$n},set:function(a){this.$n!==a&&(this.$n=a)&&this.B()}},isRouting:{get:function(){return this.Xn},set:function(a){this.Xn!==a&&(this.Xn=a)}},isRealtime:{get:function(){return this.Wn},set:function(a){this.Wn!==a&&(this.Wn=a)}},isValidLayout:{get:function(){return this.Zn},set:function(a){this.Zn!==a&&(this.Zn=a,a||(a=this.diagram,null!==
a&&(a.Oh=!0)))}},network:{get:function(){return this.j},set:function(a){this.j!==a&&(this.j=a,null!==a&&(a.layout=this))}},boundsComputation:{get:function(){return this.Um},set:function(a){this.Um!==a&&(this.Um=a,this.B())}},arrangementOrigin:{get:function(){return this.Qm},set:function(a){this.Qm.A(a)||(this.Qm.assign(a),this.B())}},id:{get:function(){return this.D},set:function(a){this.D=
a}},mayUseWorkerFunction:{get:function(){return this.qo},set:function(a){this.qo!==a&&(this.qo=a)}},workerStateChanged:{get:function(){return this.Hp},set:function(a){this.Hp!==a&&(this.Hp=a)}}});mi.prototype.useWorker=mi.prototype.Wv;mi.declareWorkerLayout=Up;mi.prototype.cancelWorker=mi.prototype.jz;mi.prototype.collectParts=mi.prototype.Ax;mi.prototype.getLayoutBounds=mi.prototype.Mi;mi.prototype.invalidateLayout=mi.prototype.B;
var Vp=new I,Xp="object"===typeof x.document&&x.document.currentScript?x.document.currentScript.src:"",Yp="undefined"!==typeof URL&&"function"===typeof URL.createObjectURL&&"function"===typeof Blob?URL.createObjectURL(new Blob(["self.onmessage=function(e){if(e.data.url){\nimportScripts(e.data.url);}}"],{type:"text/javascript"})):"";mi.className="Layout";mi.GoJSScriptURL=Xp;mi.declareWorkerLayout=Up;
"undefined"!==typeof self&&"undefined"!==typeof self.DedicatedWorkerGlobalScope&&"undefined"!==typeof self&&"undefined"!==typeof self.DedicatedWorkerGlobalScope&&(self.onmessage=function(a){a=a.data;if("_GoJS"===a._GoJS)if(a.url)importScripts(a.url);else if(a.version)self.postMessage({_GoJS:"_GoJS",version:R.version},void 0);else{var b=performance.now(),c=null;a.layout&&(c=Tp(a.layout));var d=null;c&&c.Eu&&(d=new c.Eu);if(!d)throw Error("no registered Worker Layout: "+a.layout);d.network=Zp(d,a,!0);
d.workerLayout=function(){var a=aq(d,d.network,!1);a._GoJS="_GoJS";a.time=performance.now()-b;self.postMessage(a,void 0);return!0};d.doLayout(new F)}});function Wp(){this.Eu=null;this.Yx=this.j=this.name="";this.scripts=[];this.Pe=null;this.em=new I}function Op(a){Ua(this);this.Ec=a;this.rf=new G;this.oe=new G;this.Ks=new I;this.Fs=new I}
Op.prototype.clear=function(){if(this.rf)for(var a=this.rf.iterator;a.next();)a.value.clear();if(this.oe)for(a=this.oe.iterator;a.next();)a.value.clear();this.rf=new G;this.oe=new G;this.Ks=new I;this.Fs=new I};
Op.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutNetwork"+(null!==this.layout?"("+this.layout.toString()+")":"");if(0>=a)return b;b+=" vertexes: "+this.rf.count+" edges: "+this.oe.count;if(1<a){for(var c=this.rf.iterator;c.next();)b+="\n    "+c.value.toString(a-1);for(c=this.oe.iterator;c.next();)b+="\n    "+c.value.toString(a-1)}return b};Op.prototype.createVertex=function(){return new bq(this)};Op.prototype.createEdge=function(){return new cq(this)};
Op.prototype.mg=function(a,b,c){if(null!==a){void 0===b&&(b=!1);void 0===c&&(c=null);null===c&&(c=function(a){if(a instanceof W)return!a.isLinkLabel;if(a instanceof T){var b=a.fromNode;if(null===b||b.isLinkLabel)return!1;a=a.toNode;return null===a||a.isLinkLabel?!1:!0}return!1});for(a=a.iterator;a.next();){var d=a.value;if(d instanceof W&&(!b||d.isTopLevel)&&d.canLayout()&&c(d))if(d instanceof U&&null===d.layout)this.mg(d.memberParts,!1);else if(null===this.Ji(d)){var e=this.createVertex();e.node=
d;this.ng(e)}}for(a.reset();a.next();)if(d=a.value,d instanceof T&&(!b||d.isTopLevel)&&d.canLayout()&&c(d)&&null===this.Up(d)){var f=d.fromNode;e=d.toNode;null!==f&&null!==e&&f!==e&&(f=this.findGroupVertex(f),e=this.findGroupVertex(e),null!==f&&null!==e&&this.ek(f,e,d))}}};Op.prototype.findGroupVertex=function(a){if(null===a)return null;var b=a.findVisibleNode();if(null===b)return null;a=this.Ji(b);if(null!==a)return a;for(b=b.containingGroup;null!==b;){a=this.Ji(b);if(null!==a)return a;b=b.containingGroup}return null};
t=Op.prototype;t.ng=function(a){if(null!==a){this.rf.add(a);var b=a.node;null!==b&&this.Ks.add(b,a);a.network=this}};t.Nj=function(a){if(null===a)return null;var b=this.Ji(a);null===b&&(b=this.createVertex(),b.node=a,this.ng(b));return b};t.Iu=function(a){if(null!==a&&dq(this,a)){for(var b=a.td,c=b.count-1;0<=c;c--){var d=b.J(c);this.Vj(d)}b=a.Fd;for(a=b.count-1;0<=a;a--)c=b.J(a),this.Vj(c)}};
function dq(a,b){if(null===b)return!1;var c=a.rf.remove(b);c&&(b=b.node,null!==b&&a.Ks.remove(b));return c}t.wz=function(a){null!==a&&(a=this.Ji(a),null!==a&&this.Iu(a))};t.Ji=function(a){return null===a?null:this.Ks.H(a)};t.Rl=function(a){if(null!==a){eq(this,a);var b=a.toVertex;null!==b&&b.uu(a);b=a.fromVertex;null!==b&&b.su(a)}};function eq(a,b){if(null!==b){a.oe.add(b);var c=b.link;null!==c&&null===a.Up(c)&&a.Fs.add(c,b);b.network=a}}
t.$y=function(a){if(null===a)return null;var b=a.fromNode,c=a.toNode,d=this.Up(a);null===d?(d=this.createEdge(),d.link=a,null!==b&&(d.fromVertex=this.Nj(b)),null!==c&&(d.toVertex=this.Nj(c)),this.Rl(d)):(null!==b?d.fromVertex=this.Nj(b):d.fromVertex=null,null!==c?d.toVertex=this.Nj(c):d.toVertex=null);return d};t.Vj=function(a){if(null!==a){var b=a.toVertex;null!==b&&b.Hu(a);b=a.fromVertex;null!==b&&b.Gu(a);fq(this,a)}};
function fq(a,b){null!==b&&a.oe.remove(b)&&(b=b.link,null!==b&&a.Fs.remove(b))}t.vz=function(a){null!==a&&(a=this.Up(a),null!==a&&this.Vj(a))};t.Up=function(a){return null===a?null:this.Fs.H(a)};t.ek=function(a,b,c){if(null===a||null===b)return null;if(a.network===this&&b.network===this){var d=this.createEdge();d.link=c;d.fromVertex=a;d.toVertex=b;this.Rl(d);return d}return null};t.qm=function(a){if(null!==a){var b=a.fromVertex,c=a.toVertex;null!==b&&null!==c&&(b.Gu(a),c.Hu(a),a.qm(),b.uu(a),c.su(a))}};
t.Sp=function(){for(var a=Ga(),b=this.oe.iterator;b.next();){var c=b.value;c.fromVertex===c.toVertex&&a.push(c)}b=a.length;for(c=0;c<b;c++)this.Vj(a[c]);Ja(a)};Op.prototype.deleteArtificialVertexes=function(){for(var a=Ga(),b=this.rf.iterator;b.next();){var c=b.value;null===c.node&&null===c.data&&a.push(c)}c=a.length;for(b=0;b<c;b++)this.Iu(a[b]);b=Ga();for(c=this.oe.iterator;c.next();){var d=c.value;null===d.link&&null===d.data&&b.push(d)}c=b.length;for(d=0;d<c;d++)this.Vj(b[d]);Ja(a);Ja(b)};
function gq(a){for(var b=Ga(),c=a.oe.iterator;c.next();){var d=c.value;null!==d.fromVertex&&null!==d.toVertex||b.push(d)}c=b.length;for(d=0;d<c;d++)a.Vj(b[d]);Ja(b)}
Op.prototype.Ay=function(a){void 0===a&&(a=!0);a&&(this.deleteArtificialVertexes(),gq(this),this.Sp());a=new F;for(var b=!0;b;){b=!1;for(var c=this.rf.iterator;c.next();){var d=c.value;if(0<d.td.count||0<d.Fd.count){b=this.layout.createNetwork();a.add(b);hq(this,b,d);b=!0;break}}}a.sort(function(a,b){return null===a||null===b||a===b?0:b.vertexes.count-a.vertexes.count});return a};
function hq(a,b,c){if(null!==c&&c.network!==b){dq(a,c);b.ng(c);for(var d=c.sourceEdges;d.next();){var e=d.value;e.network!==b&&(fq(a,e),eq(b,e),hq(a,b,e.fromVertex))}for(d=c.destinationEdges;d.next();)c=d.value,c.network!==b&&(fq(a,c),eq(b,c),hq(a,b,c.toVertex))}}Op.prototype.Cz=function(){for(var a=new G,b=this.rf.iterator;b.next();)a.add(b.value.node);for(b=this.oe.iterator;b.next();)a.add(b.value.link);return a};
na.Object.defineProperties(Op.prototype,{layout:{get:function(){return this.Ec},set:function(a){null!==a&&(this.Ec=a)}},vertexes:{get:function(){return this.rf}},edges:{get:function(){return this.oe}}});Op.prototype.findAllParts=Op.prototype.Cz;Op.prototype.splitIntoSubNetworks=Op.prototype.Ay;Op.prototype.deleteSelfEdges=Op.prototype.Sp;Op.prototype.reverseEdge=Op.prototype.qm;Op.prototype.linkVertexes=Op.prototype.ek;
Op.prototype.findEdge=Op.prototype.Up;Op.prototype.deleteLink=Op.prototype.vz;Op.prototype.deleteEdge=Op.prototype.Vj;Op.prototype.addLink=Op.prototype.$y;Op.prototype.addEdge=Op.prototype.Rl;Op.prototype.findVertex=Op.prototype.Ji;Op.prototype.deleteNode=Op.prototype.wz;Op.prototype.deleteVertex=Op.prototype.Iu;Op.prototype.addNode=Op.prototype.Nj;Op.prototype.addVertex=Op.prototype.ng;Op.prototype.addParts=Op.prototype.mg;Op.className="LayoutNetwork";
function bq(a){Ua(this);this.Rb=a;this.j=(new M(0,0,10,10)).freeze();this.o=(new J(5,5)).freeze();this.mi=this.jb=null;this.td=new F;this.Fd=new F}
bq.prototype.serializeVertexProperties=function(a){a.id=fb(this);a.key=this.node?this.node.key:this.data?this.data.di:void 0;void 0===a.key&&(a.key=null);a.x=this.bounds.x;a.y=this.bounds.y;a.YA=this.bounds.width;a.fA=this.bounds.height;a.fx=this.focus.x;a.fy=this.focus.y;var b=[];this.td.each(function(a){b.push(fb(a))});a.xy=b;var c=[];this.Fd.each(function(a){c.push(fb(a))});a.Hx=c};
bq.prototype.deserializeVertexProperties=function(a,b,c){if(null!==a){this.x=a.x;this.y=a.y;this.width=a.YA;this.height=a.fA;this.focusX=a.fx;this.focusY=a.fy;var d=this;a.xy&&a.xy.forEach(function(a){(a=c.get(a))&&d.td.add(a)});a.Hx&&a.Hx.forEach(function(a){(a=c.get(a))&&d.Fd.add(a)})}};bq.prototype.clear=function(){this.mi=this.jb=null;this.td=new F;this.Fd=new F};
bq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutVertex#"+fb(this);if(0<a&&(b+=null!==this.node?"("+this.node.toString()+")":"",1<a)){a="";for(var c=!0,d=this.td.iterator;d.next();){var e=d.value;c?c=!1:a+=",";a+=e.toString(0)}e="";c=!0;for(d=this.Fd.iterator;d.next();){var f=d.value;c?c=!1:e+=",";e+=f.toString(0)}b+=" sources: "+a+" destinations: "+e}return b};
bq.prototype.commit=function(){var a=this.jb;if(null!==a){var b=this.bounds,c=a.bounds;za(c)?(c.x=b.x,c.y=b.y,c.width=b.width,c.height=b.height):a.bounds=b.copy()}else if(a=this.node,null!==a){b=this.bounds;if(!(a instanceof U)){c=M.alloc();var d=this.network.layout.Mi(a,c),e=a.locationObject.da(xc);if(d.u()&&e.u()){a.moveTo(b.x+this.focusX-(e.x-d.x),b.y+this.focusY-(e.y-d.y));M.free(c);return}M.free(c)}a.moveTo(b.x,b.y)}};bq.prototype.uu=function(a){null!==a&&(this.td.contains(a)||this.td.add(a))};
bq.prototype.Hu=function(a){null!==a&&this.td.remove(a)};bq.prototype.su=function(a){null!==a&&(this.Fd.contains(a)||this.Fd.add(a))};bq.prototype.Gu=function(a){null!==a&&this.Fd.remove(a)};function iq(a,b){a=a.mi;b=b.mi;return a?b?(a=a.text,b=b.text,a<b?-1:a>b?1:0):1:null!==b?-1:0}
na.Object.defineProperties(bq.prototype,{sourceEdgesArrayAccess:{get:function(){return this.td._dataArray}},destinationEdgesArrayAccess:{get:function(){return this.Fd._dataArray}},data:{get:function(){return this.jb},set:function(a){this.jb=a;if(null!==a&&a.bounds){var b=a.bounds;a=b.x;var c=b.y,d=b.width;b=b.height;this.o.h(d/2,b/2);this.j.h(a,c,d,b)}}},node:{get:function(){return this.mi},
set:function(a){if(this.mi!==a){this.mi=a;a.Ta();var b=this.network.layout,c=M.alloc(),d=b.Mi(a,c);b=d.x;var e=d.y,f=d.width;d=d.height;isNaN(b)&&(b=0);isNaN(e)&&(e=0);this.j.h(b,e,f,d);M.free(c);if(!(a instanceof U)&&(a=a.locationObject.da(xc),a.u())){this.o.h(a.x-b,a.y-e);return}this.o.h(f/2,d/2)}}},bounds:{get:function(){return this.j},set:function(a){this.j.A(a)||this.j.assign(a)}},focus:{get:function(){return this.o},set:function(a){this.o.A(a)||
this.o.assign(a)}},centerX:{get:function(){return this.j.x+this.o.x},set:function(a){var b=this.j;b.x+this.o.x!==a&&(b.ea(),b.x=a-this.o.x,b.freeze())}},centerY:{get:function(){return this.j.y+this.o.y},set:function(a){var b=this.j;b.y+this.o.y!==a&&(b.ea(),b.y=a-this.o.y,b.freeze())}},focusX:{get:function(){return this.o.x},set:function(a){var b=this.o;b.x!==a&&(b.ea(),b.x=a,b.freeze())}},focusY:{
get:function(){return this.o.y},set:function(a){var b=this.o;b.y!==a&&(b.ea(),b.y=a,b.freeze())}},x:{get:function(){return this.j.x},set:function(a){var b=this.j;b.x!==a&&(b.ea(),b.x=a,b.freeze())}},y:{get:function(){return this.j.y},set:function(a){var b=this.j;b.y!==a&&(b.ea(),b.y=a,b.freeze())}},width:{get:function(){return this.j.width},set:function(a){var b=this.j;b.width!==a&&(b.ea(),b.width=
a,b.freeze())}},height:{get:function(){return this.j.height},set:function(a){var b=this.j;b.height!==a&&(b.ea(),b.height=a,b.freeze())}},network:{get:function(){return this.Rb},set:function(a){this.Rb=a}},sourceVertexes:{get:function(){for(var a=new G,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);return a.iterator}},destinationVertexes:{get:function(){for(var a=new G,b=
this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},vertexes:{get:function(){for(var a=new G,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);for(b=this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},sourceEdges:{get:function(){return this.td.iterator}},destinationEdges:{get:function(){return this.Fd.iterator}},edges:{get:function(){for(var a=
new F,b=this.sourceEdges;b.next();)a.add(b.value);for(b=this.destinationEdges;b.next();)a.add(b.value);return a.iterator}},edgesCount:{get:function(){return this.td.count+this.Fd.count}}});bq.prototype.deleteDestinationEdge=bq.prototype.Gu;bq.prototype.addDestinationEdge=bq.prototype.su;bq.prototype.deleteSourceEdge=bq.prototype.Hu;bq.prototype.addSourceEdge=bq.prototype.uu;bq.className="LayoutVertex";bq.standardComparer=iq;
bq.smartComparer=function(a,b){if(null!==a){if(null!==b){a=a.mi;var c=b.mi;if(null!==a){if(null!==c){b=a.text.toLocaleLowerCase().split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/);a=c.text.toLocaleLowerCase().split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/);for(c=0;c<b.length;c++)if(""!==a[c]&&void 0!==a[c]){var d=parseFloat(b[c]),e=parseFloat(a[c]);if(isNaN(d))if(isNaN(e)){if(0!==b[c].localeCompare(a[c]))return b[c].localeCompare(a[c])}else return 1;else{if(isNaN(e))return-1;if(0!==d-e)return d-e}}else if(""!==
b[c])return 1;return""!==a[c]&&void 0!==a[c]?-1:0}return 1}return null!==c?-1:0}return 1}return null!==b?-1:0};function cq(a){Ua(this);this.Qb=a;this.dd=this.Vc=this.jl=this.jb=null}cq.prototype.clear=function(){this.dd=this.Vc=this.jl=this.jb=null};cq.prototype.serializeEdgeProperties=function(a){a.id=fb(this);a.key=this.link?this.link.key:this.data?this.data.di:void 0;void 0===a.key&&(a.key=null);a.from=this.fromVertex?fb(this.fromVertex):null;a.TA=this.toVertex?fb(this.toVertex):null};
cq.prototype.deserializeEdgeProperties=function(a,b){if(null!==a){var c=b.get(a.from);c&&(this.fromVertex=c);if(a=b.get(a.TA))this.toVertex=a}};cq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutEdge#"+fb(this);0<a&&(b+=null!==this.jl?"("+this.jl.toString()+")":"",1<a&&(b+=" "+(this.Vc?this.Vc.toString():"null")+" --\x3e "+(this.dd?this.dd.toString():"null")));return b};cq.prototype.qm=function(){var a=this.Vc;this.Vc=this.dd;this.dd=a};cq.prototype.commit=function(){};
cq.prototype.Vx=function(a){return this.dd===a?this.Vc:this.Vc===a?this.dd:null};
na.Object.defineProperties(cq.prototype,{network:{get:function(){return this.Qb},set:function(a){this.Qb=a}},data:{get:function(){return this.jb},set:function(a){this.jb!==a&&(this.jb=a)}},link:{get:function(){return this.jl},set:function(a){this.jl!==a&&(this.jl=a)}},fromVertex:{get:function(){return this.Vc},set:function(a){this.Vc!==a&&(this.Vc=a)}},toVertex:{
get:function(){return this.dd},set:function(a){this.dd!==a&&(this.dd=a)}}});cq.prototype.getOtherVertex=cq.prototype.Vx;cq.className="LayoutEdge";function Fk(a){mi.call(this);this.isViewportSized=!0;this.Ip=this.Jp=NaN;this.yg=(new Fb(NaN,NaN)).freeze();this.jf=(new Fb(10,10)).freeze();this.yb=jq;this.Hb=kq;this.ad=lq;this.Tc=mq;a&&Object.assign(this,a)}ma(Fk,mi);
Fk.prototype.cloneProtected=function(a){mi.prototype.cloneProtected.call(this,a);a.Jp=this.Jp;a.Ip=this.Ip;a.yg.assign(this.yg);a.jf.assign(this.jf);a.yb=this.yb;a.Hb=this.Hb;a.ad=this.ad;a.Tc=this.Tc};Fk.prototype.gb=function(a){a.classType===Fk?a===lq||a===nq||a===oq||a===pq?this.sorting=a:a===kq||a===qq?this.arrangement=a:a===jq||a===rq?this.alignment=a:C("Unknown enum value: "+a):mi.prototype.gb.call(this,a)};
Fk.prototype.doLayout=function(a){this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var b=this.Ax(a);a=this.diagram;for(var c=b.copy().iterator;c.next();){var d=c.value;if(!d.Hh()||null===d.fromNode&&null===d.toNode){if(d.Ta(),d instanceof U)for(d=d.memberParts;d.next();)b.remove(d.value)}else b.remove(d)}var e=b.ya();if(0!==e.length){switch(this.sorting){case pq:e.reverse();break;case lq:e.sort(this.comparer);break;case nq:e.sort(this.comparer),e.reverse()}var f=this.wrappingColumn;
isNaN(f)&&(f=0);var g=this.wrappingWidth;isNaN(g)&&null!==a?(b=a.padding,g=Math.max(a.viewportBounds.width-b.left-b.right,0)):g=Math.max(this.wrappingWidth,0);0>=f&&0>=g&&(f=1);b=this.spacing.width;isFinite(b)||(b=0);c=this.spacing.height;isFinite(c)||(c=0);null!==a&&a.xa("Layout");d=[];switch(this.alignment){case rq:var h=b,k=c,l=M.alloc(),m=Math.max(this.cellSize.width,1);if(!isFinite(m))for(var n=m=0;n<e.length;n++){var p=this.Mi(e[n],l);m=Math.max(m,p.width)}m=Math.max(m+h,1);n=Math.max(this.cellSize.height,
1);if(!isFinite(n))for(p=n=0;p<e.length;p++){var r=this.Mi(e[p],l);n=Math.max(n,r.height)}n=Math.max(n+k,1);p=this.arrangement;for(var q=r=this.arrangementOrigin.x,u=this.arrangementOrigin.y,w=0,v=0,A=0;A<e.length;A++){var y=e[A],B=this.Mi(y,l),z=Math.ceil((B.width+h)/m)*m,E=Math.ceil((B.height+k)/n)*n;switch(p){case qq:var K=Math.abs(q-B.width);break;default:K=q+B.width}if(0<f&&w>f-1||0<g&&0<w&&K-r>g)d.push(new M(0,u,g+h,v)),w=0,q=r,u+=v,v=0;v=Math.max(v,E);switch(p){case qq:B=-B.width;break;default:B=
0}y.moveTo(q+B,u);switch(p){case qq:q-=z;break;default:q+=z}w++}d.push(new M(0,u,g+h,v));M.free(l);break;case jq:k=g;m=f;n=b;p=c;g=M.alloc();r=Math.max(this.cellSize.width,1);f=u=l=0;h=J.alloc();for(q=0;q<e.length;q++)v=e[q],w=this.Mi(v,g),v=ro(v,v.locationObject,v.locationSpot,h),l=Math.max(l,v.x),u=Math.max(u,w.width-v.x),f=Math.max(f,v.y);q=this.arrangement;switch(q){case qq:l+=n;break;default:u+=n}r=isFinite(r)?Math.max(r+n,1):Math.max(l+u,1);var O=v=this.arrangementOrigin.x;A=this.arrangementOrigin.y;
u=0;k>=l&&(k-=l);l=y=0;z=Math.max(this.cellSize.height,1);B=f=0;E=!0;w=J.alloc();for(K=0;K<e.length;K++){var S=e[K],Q=this.Mi(S,g),H=ro(S,S.locationObject,S.locationSpot,h);if(0<u)switch(q){case qq:O=(O-v-(Q.width-H.x))/r;O=L.aa(Math.round(O),O)?Math.round(O):Math.floor(O);O=O*r+v;break;default:O=(O-v+H.x)/r,O=L.aa(Math.round(O),O)?Math.round(O):Math.ceil(O),O=O*r+v}else switch(q){case qq:y=O+H.x+Q.width;break;default:y=O-H.x}switch(q){case qq:var da=-(O+H.x)+y;break;default:da=O+Q.width-H.x-y}if(0<
m&&u>m-1||0<k&&0<u&&da>k){d.push(new M(0,E?A-f:A,k+n,B+f+p));for(O=0;O<u&&K!==u;O++){da=e[K-u+O];var ba=ro(da,da.locationObject,da.locationSpot,w);da.moveTo(da.position.x,da.position.y+f-ba.y)}B+=p;A=E?A+B:A+(B+f);u=B=f=0;O=v;E=!1}O===v&&(l=q===qq?Math.max(l,Q.width-H.x):Math.min(l,-H.x));f=Math.max(f,H.y);B=Math.max(B,Q.height-H.y);isFinite(z)&&(B=Math.max(B,Math.max(Q.height,z)-H.y));E?S.moveTo(O-H.x,A-H.y):S.moveTo(O-H.x,A);switch(q){case qq:O-=H.x+n;break;default:O+=Q.width-H.x+n}u++}d.push(new M(0,
A,k+n,(E?B:B+f)+p));if(e.length!==u)for(k=0;k<u;k++)m=e[e.length-u+k],n=ro(m,m.locationObject,m.locationSpot,h),m.moveTo(m.position.x,m.position.y+f-n.y);J.free(h);J.free(w);if(q===qq)for(e=0;e<d.length;e++)f=d[e],f.width+=l,f.x-=l;else for(e=0;e<d.length;e++)f=d[e],f.x>l&&(f.width+=f.x-l,f.x=l);M.free(g)}for(h=f=g=e=0;h<d.length;h++)k=d[h],e=Math.min(e,k.x),g=Math.min(g,k.y),f=Math.max(f,k.x+k.width);this.arrangement===qq?this.commitLayers(d,new J(e+b/2-(f+e),g-c/2)):this.commitLayers(d,new J(e-
b/2,g-c/2));null!==a&&a.Xa("Layout");this.isValidLayout=!0}};Fk.prototype.commitLayers=function(){};function mq(a,b){a=a.text;b=b.text;return a<b?-1:a>b?1:0}
na.Object.defineProperties(Fk.prototype,{wrappingWidth:{get:function(){return this.Jp},set:function(a){this.Jp!==a&&(0<a||isNaN(a))&&(this.Jp=a,this.isViewportSized=isNaN(a),this.B())}},wrappingColumn:{get:function(){return this.Ip},set:function(a){this.Ip!==a&&(0<a||isNaN(a))&&(this.Ip=a,this.B())}},cellSize:{get:function(){return this.yg},set:function(a){this.yg.A(a)||(this.yg.assign(a),this.B())}},spacing:{
get:function(){return this.jf},set:function(a){this.jf.A(a)||(this.jf.assign(a),this.B())}},alignment:{get:function(){return this.yb},set:function(a){this.yb===a||a!==jq&&a!==rq||(this.yb=a,this.B())}},arrangement:{get:function(){return this.Hb},set:function(a){this.Hb===a||a!==kq&&a!==qq||(this.Hb=a,this.B())}},sorting:{get:function(){return this.ad},set:function(a){this.ad===a||a!==oq&&a!==pq&&
a!==lq&&a!==nq||(this.ad=a,this.B())}},comparer:{get:function(){return this.Tc},set:function(a){this.Tc!==a&&(this.Tc=a,this.B())}}});var rq=new D(Fk,"Position",0),jq=new D(Fk,"Location",1),kq=new D(Fk,"LeftToRight",2),qq=new D(Fk,"RightToLeft",3),oq=new D(Fk,"Forward",4),pq=new D(Fk,"Reverse",5),lq=new D(Fk,"Ascending",6),nq=new D(Fk,"Descending",7);Fk.className="GridLayout";Fk.standardComparer=mq;
Fk.smartComparer=function(a,b){if(null!==a){if(null!==b){a=a.text.toLocaleLowerCase().split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/);b=b.text.toLocaleLowerCase().split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/);for(var c=0;c<a.length;c++)if(""!==b[c]&&void 0!==b[c]){var d=parseFloat(a[c]),e=parseFloat(b[c]);if(isNaN(d))if(isNaN(e)){if(0!==a[c].localeCompare(b[c]))return a[c].localeCompare(b[c])}else return 1;else{if(isNaN(e))return-1;if(0!==d-e)return d-e}}else if(""!==a[c])return 1;return""!==b[c]&&
void 0!==b[c]?-1:0}return 1}return null!==b?-1:0};Fk.Position=rq;Fk.Location=jq;Fk.LeftToRight=kq;Fk.RightToLeft=qq;Fk.Forward=oq;Fk.Reverse=pq;Fk.Ascending=lq;Fk.Descending=nq;function ii(){this.Do=new G;this.ko=new G;this.Ha=new G;this.Ve=new I;this.Ue=new I;this.pj=new I;this.C=null;this.Aq=!1}t=ii.prototype;t.clear=function(){this.Do.clear();this.ko.clear();this.Ha.clear();this.Ve.clear();this.Ue.clear();this.pj.clear()};t.Ne=function(a){this.C=a};
t.Ni=function(a){if(a instanceof W){if(this.Do.add(a),a instanceof U){var b=a.containingGroup;null===b?this.C.wi.add(a):b.pl.add(a);b=a.layout;null!==b&&(b.diagram=this.C)}}else a instanceof T?this.ko.add(a):a instanceof ye||this.Ha.add(a);b=a.data;null===b||a instanceof ye||(a instanceof T?this.Ue.add(b,a):this.Ve.add(b,a))};
t.ec=function(a){a.Oj();if(a instanceof W){if(this.Do.remove(a),a instanceof U){var b=a.containingGroup;null===b?this.C.wi.remove(a):b.pl.remove(a);b=a.layout;null!==b&&(b.diagram=null)}}else a instanceof T?this.ko.remove(a):a instanceof ye||this.Ha.remove(a);b=a.data;null===b||a instanceof ye||(a instanceof T?this.Ue.remove(b):this.Ve.remove(b))};
t.Ld=function(){for(var a=this.C.nodeTemplateMap.iterator;a.next();){var b=a.value,c=a.key;(!b.Nc()||b instanceof U)&&C('Invalid node template in Diagram.nodeTemplateMap: template for "'+c+'" must be a Node or a simple Part, not a Group or Link: '+b)}for(a=this.C.groupTemplateMap.iterator;a.next();)b=a.value,c=a.key,b instanceof U||C('Invalid group template in Diagram.groupTemplateMap: template for "'+c+'" must be a Group, not a normal Node or Link: '+b);for(a=this.C.linkTemplateMap.iterator;a.next();)b=
a.value,c=a.key,b instanceof T||C('Invalid link template in Diagram.linkTemplateMap: template for "'+c+'" must be a Link, not a normal Node or simple Part: '+b);a=Ga();for(b=this.C.selection.iterator;b.next();)(c=b.value.data)&&a.push(c);b=Ga();for(c=this.C.highlighteds.iterator;c.next();){var d=c.value.data;d&&b.push(d)}c=Ga();for(d=this.nodes.iterator;d.next();){var e=d.value;null!==e.data&&(c.push(e.data),c.push(e.location))}for(d=this.links.iterator;d.next();)e=d.value,null!==e.data&&(c.push(e.data),
c.push(e.location));for(d=this.parts.iterator;d.next();)e=d.value,null!==e.data&&(c.push(e.data),c.push(e.location));this.removeAllModeledParts();this.addAllModeledParts();for(d=0;d<a.length;d++)e=this.zc(a[d]),null!==e&&(e.isSelected=!0);for(d=0;d<b.length;d++)e=this.zc(b[d]),null!==e&&(e.isHighlighted=!0);for(d=0;d<c.length;d+=2)e=this.zc(c[d]),null!==e&&(e.location=c[d+1]);Ja(a);Ja(b);Ja(c)};ii.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)};
ii.prototype.addModeledParts=function(a,b){var c=this,d=this.diagram.model;a.forEach(function(a){d.cb(a)&&sq(c,a,!1)});a.forEach(function(a){d.cb(a)&&c.resolveReferencesForData(a)});!1!==b&&Tj(this.diagram,!1)};
function sq(a,b,c){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Ve.contains(b)){void 0===c&&(c=!0);a:{if(void 0!==b&&null!==b&&!a.C.undoManager.isUndoingRedoing&&!a.Ve.contains(b)){var d=a.Yp(b);var e=Do(a,b,d);if(null!==e&&(ng(e),e=e.copy(),null!==e)){var f=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Nf=d;e.jb=b;a.Aq&&(e.Tg="Tool");a.diagram.add(e);e.jb=null;e.data=b;a.diagram.skipsModelSourceBindings=f;d=e;break a}}d=null}null!==d&&c&&a.resolveReferencesForData(b)}}
ii.prototype.insertLink=function(){return null};ii.prototype.resolveReferencesForData=function(){};ii.prototype.Yp=function(a){return this.C.model.Yp(a)};
function Do(a,b,c){a=a.C;var d=a.model;d.ck()&&d.dv(b)?(b=a.groupTemplateMap.H(c),null===b&&(b=a.groupTemplateMap.H(""),null===b&&(tq||(tq=!0,ya('No Group template found for category "'+c+'"'),ya("  Using default group template")),b=a.Ky))):(b=a.nodeTemplateMap.H(c),null===b&&(b=a.nodeTemplateMap.H(""),null===b&&(uq||(uq=!0,ya('No Node template found for category "'+c+'"'),ya("  Using default node template")),b=a.My)));return b}ii.prototype.getLinkCategoryForData=function(){return""};
ii.prototype.setLinkCategoryForData=function(){};ii.prototype.setFromNodeForLink=function(){};ii.prototype.setToNodeForLink=function(){};ii.prototype.findLinkTemplateForCategory=function(a){var b=this.C.linkTemplateMap.H(a);null===b&&(b=this.C.linkTemplateMap.H(""),null===b&&(vq||(vq=!0,ya('No Link template found for category "'+a+'"'),ya("  Using default link template")),b=this.C.Ly));return b};ii.prototype.removeAllModeledParts=function(){this.Os(this.diagram.model.nodeDataArray)};
ii.prototype.Os=function(a){var b=this;a.forEach(function(a){b.pq(a)})};ii.prototype.pq=function(a){a=this.zc(a);null!==a&&(Aj(this.diagram,a,!1),this.unresolveReferencesForPart(a))};ii.prototype.unresolveReferencesForPart=function(){};ii.prototype.removeDataForLink=function(){};ii.prototype.findPartForKey=function(a){if(null===a||void 0===a)return null;a=this.C.model.Yb(a);return null!==a?this.Ve.H(a):null};
ii.prototype.Eb=function(a){if(null===a||void 0===a)return null;a=this.C.model.Yb(a);if(null===a)return null;a=this.Ve.H(a);return a instanceof W?a:null};ii.prototype.findLinkForKey=function(){return null};t=ii.prototype;t.zc=function(a){if(null===a)return null;var b=this.Ve.H(a);return null!==b?b:b=this.Ue.H(a)};t.Gi=function(a){if(null===a)return null;a=this.Ve.H(a);return a instanceof W?a:null};t.yc=function(a){return null===a?null:this.Ue.H(a)};
t.qs=function(a){for(var b=0;b<arguments.length;++b);b=new G;for(var c=this.Do.iterator;c.next();){var d=c.value,e=d.data;if(null!==e)for(var f=0;f<arguments.length;f++){var g=arguments[f];if(za(g)&&wq(this,e,g)){b.add(d);break}}}return b.iterator};t.ps=function(a){for(var b=0;b<arguments.length;++b);b=new G;for(var c=this.ko.iterator;c.next();){var d=c.value,e=d.data;if(null!==e)for(var f=0;f<arguments.length;f++){var g=arguments[f];if(za(g)&&wq(this,e,g)){b.add(d);break}}}return b.iterator};
function wq(a,b,c){for(var d in c){var e=b[d],f=c[d];if(Aa(f)){if(!Aa(e)||e.length<f.length)return!1;for(var g=0;g<e.length;g++){var h=f[g];if(void 0!==h&&!xq(a,e[g],h))return!1}}else if(!xq(a,e,f))return!1}return!0}function xq(a,b,c){if("function"===typeof c){if(!c(b))return!1}else if(c instanceof RegExp){if(!b||!c.test(b.toString()))return!1}else if(za(b)&&za(c)){if(!wq(a,b,c))return!1}else if(b!==c)return!1;return!0}
ii.prototype.doModelChanged=function(a){if(this.C){var b=this.C;if(a.model===b.model){var c=a.change;b.doModelChanged(a);if(b.Z){b.Z=!1;try{var d=a.modelChange;if(""!==d)if(c===ge){if("nodeCategory"===d){var e=this.zc(a.object),f=a.newValue;null!==e&&"string"===typeof f&&(e.category=f)}else"nodeDataArray"===d&&(this.Os(a.oldValue),this.addModeledParts(a.newValue));b.isModified=!0}else if(c===ie){var g=a.newValue;"nodeDataArray"===d&&za(g)&&sq(this,g);b.isModified=!0}else if(c===pe){var h=a.oldValue;
"nodeDataArray"===d&&za(h)&&this.pq(h);b.isModified=!0}else c===he&&("SourceChanged"===d?null!==a.object?this.updateDataBindings(a.object,a.propertyName):(this.yq(),this.updateAllTargetBindings()):"ModelDisplaced"===d&&this.Ld());else if(c===ge){var k=a.propertyName,l=a.object;if(l===b.model){if("nodeKeyProperty"===k||"nodeCategoryProperty"===k)b.undoManager.isUndoingRedoing||this.Ld()}else this.updateDataBindings(l,k);b.isModified=!0}else if(c===ie||c===pe){var m=a.change===ie,n=m?a.newParam:a.oldParam,
p=m?a.newValue:a.oldValue,r=this.pj.H(a.object);if(Array.isArray(r))for(a=0;a<r.length;a++){var q=r[a];if(m)cn(q,p,n,!0);else if(!(0>n)){var u=n+Vm(q);q.ec(u,!0);fn(q,u,n)}}b.isModified=!0}}finally{b.Z=!0}}}}};ii.prototype.updateAllTargetBindings=function(a){void 0===a&&(a="");for(var b=this.parts.iterator;b.next();)b.value.Fa(a);for(b=this.nodes.iterator;b.next();)b.value.Fa(a);for(b=this.links.iterator;b.next();)b.value.Fa(a)};
ii.prototype.yq=function(){for(var a=this.C.model,b=new G,c=a.nodeDataArray,d=0;d<c.length;d++)b.add(c[d]);var e=[];this.nodes.each(function(a){null===a.data||b.contains(a.data)||e.push(a.data)});this.parts.each(function(a){null===a.data||b.contains(a.data)||e.push(a.data)});e.forEach(function(b){yq(a,b,!1)});for(d=0;d<c.length;d++){var f=c[d];null===this.zc(f)&&zq(a,f,!1)}this.refreshDataBoundLinks();for(c=this.parts.iterator;c.next();)c.value.updateRelationshipsFromData();for(c=this.nodes.iterator;c.next();)c.value.updateRelationshipsFromData();
for(c=this.links.iterator;c.next();)c.value.updateRelationshipsFromData()};ii.prototype.refreshDataBoundLinks=function(){};ii.prototype.updateRelationshipsFromData=function(){};
ii.prototype.updateDataBindings=function(a,b){if("string"===typeof b){var c=this.zc(a);if(null!==c)c.Fa(b);else{c=null;for(var d=this.pj.iterator;d.next();){for(var e=d.value,f=0;f<e.length;f++){var g=e[f].Nx(a);null!==g&&(null===c&&(c=Ga()),c.push(g))}if(null!==c)break}if(null!==c){for(d=0;d<c.length;d++)c[d].Fa(b);Ja(c)}}a===this.diagram.model.modelData&&this.updateAllTargetBindings(b)}};
function wj(a,b){var c=b.ci;if(Aa(c)){var d=a.pj.H(c);if(null===d)d=[],d.push(b),a.pj.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}function zj(a,b,c){uj(b,function(a){a=a.T.m;for(var b=a.length,d=0;d<b;d++)Rj(c,a[d])});var d=b.ci;if(Aa(d)){var e=a.pj.H(d);if(null!==e)for(var f=0;f<e.length;f++)if(e[f]===b){e.splice(f,1);0===e.length&&a.pj.remove(d);break}}}
ii.prototype.Tj=function(a,b,c){void 0===c&&(c=!1);var d=new I;if(Aa(a))for(var e=0;e<a.length;e++)Aq(this,a[e],b,d,c);else for(a=a.iterator;a.next();)Aq(this,a.value,b,d,c);if(null!==b){c=b.model;a=b.toolManager.findTool("Dragging");a=null!==a?a.dragOptions.dragsLink:b.on.dragsLink;e=new G;for(var f=new I,g=d.iterator;g.next();){var h=g.value;if(h instanceof T)a||null!==h.fromNode&&null!==h.toNode||e.add(h);else if(h instanceof W&&null!==h.data&&c.dm()){var k=h;h=g.key;var l=h.qg();null!==l&&(l=
d.H(l),null!==l?(c.he(k.data,c.pa(l.data)),k=b.yc(k.data),h=h.Ii(),null!==h&&null!==k&&f.add(h,k)):c.he(k.data,void 0))}}0<e.count&&b.Ps(e,!1);if(0<f.count)for(c=f.iterator;c.next();)d.add(c.key,c.value)}if(null!==b&&null!==this.C&&(b=b.model,c=b.afterCopyFunction,null!==c)){var m=new I;d.each(function(a){null!==a.key.data&&m.add(a.key.data,a.value.data)});c(m,b,this.C.model)}for(b=d.iterator;b.next();)b.value.Fa();return d};
function Aq(a,b,c,d,e){if(null===b||e&&!b.canCopy())return null;if(d.contains(b))return d.H(b);var f=a.copyPartData(b,c);if(!(f instanceof V))return null;f.isSelected=!1;f.isHighlighted=!1;d.add(b,f);if(b instanceof W){for(var g=b.linksConnected;g.next();){var h=g.value;if(h.fromNode===b){var k=d.H(h);null!==k&&(k.fromNode=f)}h.toNode===b&&(h=d.H(h),null!==h&&(h.toNode=f))}if(b instanceof U&&f instanceof U)for(b=b.memberParts;b.next();)g=Aq(a,b.value,c,d,e),g instanceof T||null===g||(g.containingGroup=
f)}else if(b instanceof T&&f instanceof T)for(g=b.fromNode,null!==g&&(g=d.H(g),null!==g&&(f.fromNode=g)),g=b.toNode,null!==g&&(g=d.H(g),null!==g&&(f.toNode=g)),b=b.labelNodes;b.next();)g=Aq(a,b.value,c,d,e),null!==g&&g instanceof W&&(g.labeledLink=f);return f}
ii.prototype.copyPartData=function(a,b){var c=null,d=a.data;if(null!==d&&null!==b){var e=b.model;a instanceof T||(d=e.copyNodeData(d),za(d)&&(e.sf(d),c=b.zc(d)))}else ng(a),c=a.copy(),null!==c&&(e=this.C,null!==b?b.add(c):null!==d&&null!==e&&null!==e.commandHandler&&e.commandHandler.copiesClipboardData&&(b=e.model,e=null,c instanceof T||(e=b.copyNodeData(d)),za(e)&&(c.data=e)));return c};
na.Object.defineProperties(ii.prototype,{nodes:{get:function(){return this.Do}},links:{get:function(){return this.ko}},parts:{get:function(){return this.Ha}},diagram:{get:function(){return this.C}},addsToTemporaryLayer:{get:function(){return this.Aq},set:function(a){this.Aq=a}}});ii.prototype.updateAllRelationshipsFromData=ii.prototype.yq;
ii.prototype.findLinksByExample=ii.prototype.ps;ii.prototype.findNodesByExample=ii.prototype.qs;ii.prototype.findLinkForData=ii.prototype.yc;ii.prototype.findNodeForData=ii.prototype.Gi;ii.prototype.findPartForData=ii.prototype.zc;ii.prototype.findNodeForKey=ii.prototype.Eb;ii.prototype.removeModeledPart=ii.prototype.pq;ii.prototype.removeModeledParts=ii.prototype.Os;ii.prototype.rebuildParts=ii.prototype.Ld;var uq=!1,tq=!1,vq=!1;ii.className="PartManager";
function Bq(a){ii.apply(this,arguments)}ma(Bq,ii);Bq.prototype.addAllModeledParts=function(){var a=this.diagram.model;this.addModeledParts(a.nodeDataArray);Cq(this,a.linkDataArray)};Bq.prototype.addModeledParts=function(a){ii.prototype.addModeledParts.call(this,a,!1);for(a=this.links.iterator;a.next();)Eo(a.value);Tj(this.diagram,!1)};function Cq(a,b){b.forEach(function(b){Dq(a,b)});Tj(a.diagram,!1)}
function Dq(a,b){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Ue.contains(b)){var c=a.getLinkCategoryForData(b),d=a.findLinkTemplateForCategory(c);if(null!==d){ng(d);var e=d.copy();if(null!==e){d=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Nf=c;e.jb=b;c=a.diagram.model;var f=Eq(c,b,!0);""!==f&&(e.fromPortId=f);f=Fq(c,b,!0);void 0!==f&&(f=a.Eb(f),f instanceof W&&(e.fromNode=f));f=Eq(c,b,!1);""!==f&&(e.toPortId=f);f=Fq(c,b,!1);void 0!==f&&(f=a.Eb(f),
f instanceof W&&(e.toNode=f));c=c.Bf(b);Array.isArray(c)&&c.forEach(function(b){b=a.Eb(b);null!==b&&(b.labeledLink=e)});a.Aq&&(e.Tg="Tool");a.diagram.add(e);e.jb=null;e.data=b;a.diagram.skipsModelSourceBindings=d}}}}Bq.prototype.removeAllModeledParts=function(){var a=this.diagram.model;Gq(this,a.linkDataArray);this.Os(a.nodeDataArray)};function Gq(a,b){b.forEach(function(b){a.pq(b)})}Bq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.ts(a)};
Bq.prototype.setLinkCategoryForData=function(a,b){return this.diagram.model.sq(a,b)};Bq.prototype.setFromNodeForLink=function(a,b){var c=this.diagram.model;c.Gv(a.data,c.pa(null!==b?b.data:null))};Bq.prototype.setToNodeForLink=function(a,b){var c=this.diagram.model;c.Kv(a.data,c.pa(null!==b?b.data:null))};Bq.prototype.removeDataForLink=function(a){this.diagram.model.lm(a.data)};
Bq.prototype.findPartForKey=function(a){var b=ii.prototype.findPartForKey.call(this,a);return null===b&&(a=this.diagram.model.Dh(a),null!==a)?this.Ue.H(a):b};Bq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Dh(a);return null!==a?this.Ue.H(a):null};
Bq.prototype.doModelChanged=function(a){var b=this;ii.prototype.doModelChanged.call(this,a);if(this.diagram){var c=this.diagram;if(a.model===c.model){var d=a.change;if(c.Z){c.Z=!1;try{var e=a.modelChange;if(""!==e)if(d===ge){if("linkFromKey"===e){var f=this.yc(a.object);if(null!==f){var g=this.Eb(a.newValue);f.fromNode=g}}else if("linkToKey"===e){var h=this.yc(a.object);if(null!==h){var k=this.Eb(a.newValue);h.toNode=k}}else if("linkFromPortId"===e){var l=this.yc(a.object);if(null!==l){var m=a.newValue;
"string"===typeof m&&(l.fromPortId=m)}}else if("linkToPortId"===e){var n=this.yc(a.object);if(null!==n){var p=a.newValue;"string"===typeof p&&(n.toPortId=p)}}else if("nodeGroupKey"===e){var r=this.zc(a.object);if(null!==r){var q=a.newValue;if(void 0!==q){var u=this.Eb(q);u instanceof U?r.containingGroup=u:r.containingGroup=null}else r.containingGroup=null}}else if("linkLabelKeys"===e){var w=this.yc(a.object);if(null!==w){var v=a.oldValue,A=a.newValue;Array.isArray(v)&&v.forEach(function(a){0<=A.indexOf(a)||
(a=b.Eb(a),null!==a&&(a.labeledLink=null))});Array.isArray(A)&&A.forEach(function(a){a=b.Eb(a);null!==a&&(a.labeledLink=w)})}}else if("linkCategory"===e){var y=this.yc(a.object),B=a.newValue;null!==y&&"string"===typeof B&&(y.category=B)}else"linkDataArray"===e&&(Gq(this,a.oldValue),Cq(this,a.newValue));c.isModified=!0}else if(d===ie){var z=a.newValue;if("linkDataArray"===e&&"object"===typeof z&&null!==z)Dq(this,z);else if("linkLabelKeys"===e&&Hq(z)){var E=this.yc(a.object),K=this.Eb(z);null!==E&&
null!==K&&(K.labeledLink=E)}c.isModified=!0}else{if(d===pe){var O=a.oldValue;if("linkDataArray"===e&&"object"===typeof O&&null!==O)this.pq(O);else if("linkLabelKeys"===e&&Hq(O)){var S=this.Eb(O);null!==S&&(S.labeledLink=null)}c.isModified=!0}}else if(d===ge){var Q=a.propertyName;a.object!==c.model||"linkFromKeyProperty"!==Q&&"linkToKeyProperty"!==Q&&"linkFromPortIdProperty"!==Q&&"linkToPortIdProperty"!==Q&&"linkLabelKeysProperty"!==Q&&"nodeIsGroupProperty"!==Q&&"nodeGroupKeyProperty"!==Q&&"linkCategoryProperty"!==
Q||c.undoManager.isUndoingRedoing||this.Ld();c.isModified=!0}}finally{c.Z=!0}}}}};Bq.prototype.refreshDataBoundLinks=function(){var a=this,b=this.diagram.model,c=new G,d=b.linkDataArray;d.forEach(function(a){c.add(a)});var e=[];this.links.each(function(a){null===a.data||c.contains(a.data)||e.push(a.data)});e.forEach(function(a){Iq(b,a,!1)});d.forEach(function(c){null===a.yc(c)&&Jq(b,c,!1)})};
Bq.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;if(a instanceof T){var e=Fq(d,b,!0);e=c.Eb(e);a.fromNode=e;e=Fq(d,b,!1);e=c.Eb(e);a.toNode=e;b=d.Bf(b);if(0<b.length||0<a.labelNodes.count){if(1===b.length&&1===a.labelNodes.count){e=b[0];var f=a.labelNodes.first();if(d.pa(f.data)===e)return}e=(new G).addAll(b);var g=new G;a.labelNodes.each(function(a){null!==a.data&&(a=d.pa(a.data),void 0!==a&&g.add(a))});b=g.copy();b.oq(e);e=
e.copy();e.oq(g);if(0<b.count||0<e.count)b.each(function(b){b=c.Eb(b);null!==b&&b.labeledLink===a&&(b.labeledLink=null)}),e.each(function(b){b=c.Eb(b);null!==b&&b.labeledLink!==a&&(b.labeledLink=a)})}}else!(a instanceof ye)&&(b=d.Eh(b),b=c.findPartForKey(b),null===b||b instanceof U)&&(a.containingGroup=b)}}};
Bq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.pa(a);if(void 0!==c){var d=Kq(b,c),e=this.zc(a);if(null!==d&&null!==e){d=d.iterator;for(var f={};d.next();){var g=d.value;b.cb(g)?e instanceof U&&b.Eh(g)===c&&(g=this.zc(g),null!==g&&(g.containingGroup=e)):(f.link=this.yc(g),null!==f.link&&e instanceof W&&(Fq(b,g,!0)===c&&(f.link.fromNode=e),Fq(b,g,!1)===c&&(f.link.toNode=e),g=b.Bf(g),Array.isArray(g)&&g.some(function(a){return function(b){return b===c?(e.labeledLink=a.link,
!0):!1}}(f))));f={link:f.link}}Lq(b,c)}a=b.Eh(a);void 0!==a&&(a=this.Eb(a),a instanceof U&&(e.containingGroup=a))}};Bq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof W){var c=b.pa(a.data);if(void 0!==c){for(var d=a.linksConnected;d.next();)Mq(b,c,d.value.data);a.isLinkLabel&&(d=a.labeledLink,null!==d&&Mq(b,c,d.data));if(a instanceof U)for(a=a.memberParts;a.next();)d=a.value.data,b.cb(d)&&Mq(b,c,d)}}};
Bq.prototype.copyPartData=function(a,b){var c=ii.prototype.copyPartData.call(this,a,b);if(a instanceof T)if(a=a.data,null!==a&&null!==b){var d=b.model;a=d.Rp(a);"object"===typeof a&&null!==a&&(d.Bi(a),c=b.yc(a))}else null!==c&&(b=this.diagram,null!==a&&null!==b&&null!==b.commandHandler&&b.commandHandler.copiesClipboardData&&(b=b.model.Rp(a),"object"===typeof b&&null!==b&&(c.data=b)));return c};
Bq.prototype.insertLink=function(a,b,c,d){var e=this.diagram,f=e.model,g=e.toolManager.findTool("Linking"),h="";null!==a&&(null===b&&(b=a),h=b.portId,null===h&&(h=""));b="";null!==c&&(null===d&&(d=c),b=d.portId,null===b&&(b=""));d=g.archetypeLinkData;if(d instanceof T){if(ng(d),f=d.copy(),null!==f)return f.fromNode=a,f.fromPortId=h,f.toNode=c,f.toPortId=b,e.add(f),a=g.archetypeLabelNodeData,a instanceof W&&(ng(a),a=a.copy(),null!==a&&(a.labeledLink=f,e.add(a))),f}else if(null!==d&&(d=f.Rp(d),"object"===
typeof d&&null!==d))return null!==a&&Nq(f,d,f.pa(a.data),!0),Oq(f,d,h,!0),null!==c&&Nq(f,d,f.pa(c.data),!1),Oq(f,d,b,!1),f.Bi(d),a=g.archetypeLabelNodeData,null===a||a instanceof W||(a=f.copyNodeData(a),"object"===typeof a&&null!==a&&(f.sf(a),a=f.pa(a),void 0!==a&&f.tu(d,a))),e.yc(d);return null};Bq.prototype.findLinkForKey=Bq.prototype.findLinkForKey;Bq.prototype.findPartForKey=Bq.prototype.findPartForKey;Bq.prototype.removeAllModeledParts=Bq.prototype.removeAllModeledParts;
Bq.prototype.addModeledParts=Bq.prototype.addModeledParts;Bq.prototype.addAllModeledParts=Bq.prototype.addAllModeledParts;Bq.className="GraphLinksPartManager";function Pq(){ii.apply(this,arguments);this.ih=null}ma(Pq,ii);
function Qq(a,b,c){if(null!==b&&null!==c){var d=a.diagram.toolManager.findTool("Linking"),e=b,f=c;if(a.diagram.isTreePathToChildren)for(b=f.linksConnected;b.next();){if(b.value.toNode===f)return}else for(e=c,f=b,b=e.linksConnected;b.next();)if(b.value.fromNode===e)return;if(null===d||!Ef(d,e,f,null,!0))if(d=a.getLinkCategoryForData(c.data),b=a.findLinkTemplateForCategory(d),null!==b&&(ng(b),b=b.copy(),null!==b)){var g=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;b.Nf=d;
b.jb=c.data;b.fromNode=e;b.toNode=f;a.diagram.add(b);b.jb=null;b.data=c.data;a.diagram.skipsModelSourceBindings=g}}}Pq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.ws(a)};Pq.prototype.setLinkCategoryForData=function(a,b){this.diagram.model.Ts(a,b)};
Pq.prototype.setFromNodeForLink=function(a,b,c){var d=this.diagram.model;void 0===c&&(c=null);b=null!==b?b.data:null;if(this.diagram.isTreePathToChildren)d.he(a.data,d.pa(b));else{var e=this.ih;this.ih=a;null!==c&&d.he(c.data,void 0);d.he(b,d.pa(null!==a.toNode?a.toNode.data:null));this.ih=e}};
Pq.prototype.setToNodeForLink=function(a,b,c){var d=this.diagram.model;void 0===c&&(c=null);b=null!==b?b.data:null;if(this.diagram.isTreePathToChildren){var e=this.ih;this.ih=a;null!==c&&d.he(c.data,void 0);d.he(b,d.pa(null!==a.fromNode?a.fromNode.data:null));this.ih=e}else d.he(a.data,d.pa(b))};Pq.prototype.removeDataForLink=function(a){this.diagram.model.he(a.data,void 0)};
Pq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Yb(a);return null!==a?this.Ue.H(a):null};
Pq.prototype.doModelChanged=function(a){ii.prototype.doModelChanged.call(this,a);if(this.diagram){var b=this.diagram;if(a.model===b.model){var c=a.change;if(b.Z){b.Z=!1;try{var d=a.modelChange;if(""!==d){if(c===ge){if("nodeParentKey"===d){var e=a.object,f=this.Eb(a.newValue),g=this.Gi(e);if(null!==this.ih)null!==f&&(this.ih.data=e,this.ih.category=this.getLinkCategoryForData(e));else if(null!==g){var h=g.Ii();null!==h?null===f?b.remove(h):b.isTreePathToChildren?h.fromNode=f:h.toNode=f:Qq(this,f,g)}}else if("parentLinkCategory"===
d){var k=this.Gi(a.object),l=a.newValue;if(null!==k&&"string"===typeof l){var m=k.Ii();null!==m&&(m.category=l)}}b.isModified=!0}}else if(c===ge){var n=a.propertyName;a.object===b.model&&"nodeParentKeyProperty"===n&&(b.undoManager.isUndoingRedoing||this.Ld());b.isModified=!0}}finally{b.Z=!0}}}}};
Pq.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;a instanceof W&&(b=d.Fh(b),b=c.Eb(b),d=a.qg(),b!==d&&(d=a.Ii(),null!==b?null!==d?c.isTreePathToChildren?d.fromNode=b:d.toNode=b:Qq(this,b,a):null!==d&&Aj(c,d,!1)))}}};Pq.prototype.updateDataBindings=function(a,b){ii.prototype.updateDataBindings.call(this,a,b);"string"===typeof b&&null!==this.zc(a)&&(a=this.yc(a),null!==a&&a.Fa(b))};
Pq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.pa(a);if(void 0!==c){var d=Kq(b,c),e=this.zc(a);if(null!==d&&null!==e){for(d=d.iterator;d.next();){var f=d.value;b.cb(f)&&e instanceof W&&b.Fh(f)===c&&Qq(this,e,this.Gi(f))}Lq(b,c)}a=b.Fh(a);void 0!==a&&e instanceof W&&(a=this.Eb(a),Qq(this,a,e))}};
Pq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof W){var c=b.pa(a.data),d=this.yc(a.data);if(null!==d){d.isSelected=!1;d.isHighlighted=!1;var e=d.layer;if(null!==e){var f=e.ec(-1,d,!1);0<=f&&this.diagram.Wa(pe,"parts",e,d,null,f,null);f=d.layerChanged;null!==f&&f(d,e,null)}}d=this.diagram.isTreePathToChildren;for(a=a.linksConnected;a.next();)e=a.value,e=(d?e.toNode:e.fromNode).data,b.cb(e)&&Mq(b,c,e)}};
Pq.prototype.insertLink=function(a,b,c){b=this.diagram.model;var d=a,e=c;this.diagram.isTreePathToChildren||(d=c,e=a);return null!==d&&null!==e?(b.he(e.data,b.pa(d.data)),e.Ii()):null};Pq.prototype.findLinkForKey=Pq.prototype.findLinkForKey;Pq.className="TreePartManager";
function Z(a,b){this.tl=new G;this.rl=new G;this.ww=',\n  "insertedNodeKeys": ';this.Iy=',\n  "modifiedNodeData": ';this.yw=',\n  "removedNodeKeys": ';this.Mh=null;Ua(this);this.kn=this.na="";this.Rg=!1;this.j={};this.Gc=[];this.bb=new I;this.ni="key";this.Ik=this.ll=null;this.an=this.bn=!1;this.dn=!0;this.Nm=null;this.yj="category";this.Pf=new I;this.Ot=new F;this.kh=!1;this.o=null;this.undoManager=new re;void 0!==a&&(Aa(a)?this.nodeDataArray=a:Object.assign(this,a));b&&Object.assign(this,b)}
Z.prototype.cloneProtected=function(a){a.na=this.na;a.kn=this.kn;a.Rg=this.Rg;a.ni=this.ni;a.ll=this.ll;a.Ik=this.Ik;a.bn=this.bn;a.an=this.an;a.dn=this.dn;a.Nm=this.Nm;a.yj=this.yj};Z.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};Z.prototype.clear=function(){this.Gc=[];this.bb.clear();this.Pf.clear();this.undoManager.clear()};
Z.prototype.toString=function(a){void 0===a&&(a=0);if(1<a)return this.uq();var b=(""!==this.name?this.name:"")+" Model";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.pa(e)+":"+La(e)}}return b};
Z.prototype.UA=function(a){a.change!==he&&C("Model.toIncrementalData argument is not a Transaction ChangedEvent:"+a.toString());var b=a.object;if(!(a.isTransactionFinished&&b instanceof qe))return null;Rq(this,b);a=this.aw(b,"FinishedUndo"===a.propertyName);this.Mh=null;return a};
Z.prototype.aw=function(a,b){var c=this,d=!1,e=new G,f=new G,g=new G,h=this.Mh;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===ie?e.add(a.newValue):a.change===pe&&g.add(a.oldValue):c.cb(a.object)?f.add(a.object):a.change!==ge||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.cb(a)&&f.add(a)}):a.object instanceof Z||c.Pi()&&c.xc(a.object)||Sq(c,a.object).each(function(a){f.add(a)})):
d=!0)});var k=this.rl;k.clear();e.each(function(a){k.add(c.pa(a));b||f.add(a)});var l=this.tl;l.clear();g.each(function(a){l.add(c.pa(a));b&&f.add(a)});a=c.cloneDeep(f.ya());var m=null;d&&(null===m&&(m={}),m.modelData=this.cloneDeep(this.modelData));0<k.count&&(null===m&&(m={}),b?m.removedNodeKeys=k.ya():m.insertedNodeKeys=k.ya());0<a.length&&(null===m&&(m={}),m.modifiedNodeData=a);0<l.count&&(null===m&&(m={}),b?m.insertedNodeKeys=l.ya():m.removedNodeKeys=l.ya());l.clear();k.clear();return m};
Z.prototype.cloneDeep=function(a){return Tq(this,a,!0)};
function Tq(a,b,c,d,e,f){function g(a,c){h?(void 0===a.__gohashid&&f.push(a),d.set(a,c)):(a=lb++,d.set(a,c),e.set(a,b))}if(!za(b))return b;f||(f=[]);var h=Object.isExtensible(b);d||(d=new I);if(h){var k=d.get(b);if(k)return k}else for(e||(e=new I),k=e.iterator;k.next();){var l=k.key;if(k.value===b&&(l=d.get(l)))return l}if(Array.isArray(b)){k=[];g(b,k);for(var m=0;m<b.length;m++)k.push(Tq(a,b[m],!1,d,e,f))}else if(b instanceof J||b instanceof Fb||b instanceof M||b instanceof kc||b instanceof N)k=
b.copy(),g(b,k);else{if(b instanceof gl||b instanceof P||b instanceof D)return b;if(b instanceof F)k=(new F).addAll(Tq(a,b.ya(),!1,d,e,f)),g(b,k);else if(b instanceof G)k=(new G).addAll(Tq(a,b.ya(),!1,d,e,f)),g(b,k);else if(b instanceof I)k=(new I).addAll(Tq(a,b.ya(),!1,d,e,f)),g(b,k);else if(b instanceof Date)k=new Date(b.getTime()),g(b,k);else if(b instanceof RegExp)k=new RegExp(b),g(b,k),k.lastIndex=b.lastIndex;else if("function"===typeof b.copy)k=b.copy(),g(b,k);else for(m in k={},g(b,k),b)"__gohashid"!==
m&&(k[m]=Tq(a,b[m],!1,d,e,f))}c&&f.forEach(function(a){delete a.__gohashid});return k}t=Z.prototype;t.quote=function(a){return JSON.stringify(a).replace(/[\u007F-\uFFFF]/g,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).substr(-4)})};
t.Dm=function(){var a="";""!==this.name&&(a+=',\n  "name": '+this.quote(this.name));""!==this.dataFormat&&(a+=',\n  "dataFormat": '+this.quote(this.dataFormat));this.isReadOnly&&(a+=',\n  "isReadOnly": '+this.isReadOnly);"key"!==this.nodeKeyProperty&&"string"===typeof this.nodeKeyProperty&&(a+=',\n  "nodeKeyProperty": '+this.quote(this.nodeKeyProperty));this.copiesArrays&&(a+=',\n  "copiesArrays": true');this.copiesArrayObjects&&(a+=',\n  "copiesArrayObjects": true');this.copiesKey||(a+=',\n  "copiesKey": false');
"category"!==this.nodeCategoryProperty&&"string"===typeof this.nodeCategoryProperty&&(a+=',\n  "nodeCategoryProperty": '+this.quote(this.nodeCategoryProperty));return a};
t.mq=function(a){a.name&&(this.name=a.name);a.dataFormat&&(this.dataFormat=a.dataFormat);a.isReadOnly&&(this.isReadOnly=!0);a.nodeKeyProperty&&(this.nodeKeyProperty=a.nodeKeyProperty);a.copiesArrays&&(this.copiesArrays=!0);a.copiesArrayObjects&&(this.copiesArrayObjects=!0);!1===a.copiesKey&&(this.copiesKey=!1);a.nodeCategoryProperty&&(this.nodeCategoryProperty=a.nodeCategoryProperty)};function Uq(a,b){b=b.modelData;za(b)&&(a.nm(b),a.modelData=b)}
t.bw=function(){var a=this.modelData,b=!1,c;for(c in a)if(!Vq(c,a[c])){b=!0;break}a="";b&&(a=',\n  "modelData": '+Wq(this,this.modelData));return a+',\n  "nodeDataArray": '+Xq(this,this.nodeDataArray,!0)};t.wv=function(a){Uq(this,a);a=a.nodeDataArray;Aa(a)&&(this.nm(a),this.nodeDataArray=a)};
function Rq(a,b){function c(a,b){if(b=b.part)if(b=b.data,a!==b){var c=d.get(a);null===c?(c=new G,c.add(b),d.add(a,c)):c.add(b)}}var d=a.Mh;null===d&&(d=new I,b.changes.each(function(a){if(null!==a.diagram){var b=a.change;if(b===ge)(a=a.object.panel)&&(b=a.data)&&c(b,a);else if(b===ie||b===pe)a=a.object,(b=a.itemArray)&&c(b,a)}}),a.Mh=d)}function Sq(a,b){for(var c=new G,d=0;d<a.nodeDataArray.length;d++){var e=a.nodeDataArray[d];Yq(a,b,e,e,c)}return c}
function Yq(a,b,c,d,e){if(Array.isArray(c))for(var f=0;f<c.length;f++){var g=c[f];if(g===b)return e.add(d),!0;if(Yq(a,b,g,d,e))return!0}else if(za(c)&&Object.getPrototypeOf(c)===Object.prototype)for(f in c){g=c[f];if(g===b)return e.add(d),!0;if(Yq(a,b,g,d,e))return!0}return!1}
t.$v=function(a,b){var c=this,d=!1,e=new G,f=new G,g=new G,h=this.Mh;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===ie?e.add(a.newValue):a.change===pe&&g.add(a.oldValue):c.cb(a.object)?f.add(a.object):a.change!==ge||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.cb(a)&&f.add(a)}):a.object instanceof Z||c.Pi()&&c.xc(a.object)||Sq(c,a.object).each(function(a){f.add(a)})):d=!0)});var k=
this.rl;k.clear();e.each(function(a){k.add(c.pa(a));b||f.add(a)});var l=this.tl;l.clear();g.each(function(a){l.add(c.pa(a));b&&f.add(a)});a="";d&&(a+=',\n  "modelData": '+Wq(this,this.modelData));0<k.count&&(a+=(b?this.yw:this.ww)+Xq(this,k.ya(),!0));0<f.count&&(a+=this.Iy+Xq(this,f.ya(),!0));0<l.count&&(a+=(b?this.ww:this.yw)+Xq(this,l.ya(),!0));l.clear();k.clear();return a};
t.lq=function(a){(void 0!==a.name&&a.name!==this.name||void 0!==a.dataFormat&&a.dataFormat!==this.dataFormat||void 0!==a.isReadOnly&&a.isReadOnly!==this.isReadOnly||void 0!==a.nodeKeyProperty&&a.nodeKeyProperty!==this.nodeKeyProperty||void 0!==a.copiesArrays&&a.copiesArrays!==this.copiesArrays||void 0!==a.copiesArrayObjects&&a.copiesArrayObjects!==this.copiesArrayObjects||void 0!==a.copiesKey&&a.copiesKey!==this.copiesKey||void 0!==a.nodeCategoryProperty&&a.nodeCategoryProperty!==this.nodeCategoryProperty)&&
C("applyIncrementalJson cannot change Model properties");Uq(this,a);var b=a.insertedNodeKeys,c=a.modifiedNodeData,d=new I;if(Array.isArray(c))for(var e=0;e<c.length;e++){var f=c[e],g=this.pa(f);void 0!==g&&null!==g&&d.set(g,f)}if(Array.isArray(b))for(e=b.length,f=0;f<e;f++){g=b[f];var h=this.Yb(g);null===h&&(h=(h=d.get(g))?h:this.copyNodeData({}),this.um(h,g),this.sf(h))}if(Array.isArray(c))for(b=c.length,d=0;d<b;d++)if(e=c[d],f=this.pa(e),f=this.Yb(f),null!==f){for(var k in e)"__gohashid"===k||k===
this.nodeKeyProperty||this.bk()&&k===this.nodeIsGroupProperty||this.setDataProperty(f,k,e[k]);this.vm(e,f)}a=a.removedNodeKeys;if(Array.isArray(a))for(c=a.length,k=0;k<c;k++)b=this.Yb(a[k]),null!==b&&this.mm(b)};
t.By=function(a,b){a.change!==he&&C("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+a.toString());var c=a.object;if(!(a.isTransactionFinished&&c instanceof qe))return'{ "incremental": 0 }';void 0===b&&(b=Zq(this,this));Rq(this,c);a=this.$v(c,"FinishedUndo"===a.propertyName);this.Mh=null;return"2"===b?'{ "incremental": 2'+a+"}":'{ "class": '+this.quote(b)+', "incremental": 1'+this.Dm()+a+"}"};t.VA=function(a,b){return this.By(a,b)};
t.uq=function(a){void 0===a&&(a=Zq(this,this));return'{ "class": '+this.quote(a)+this.Dm()+this.bw()+"}"};t.toJSON=function(a){return this.uq(a)};t.wx=function(a){var b=null;if("string"===typeof a)try{b=x.JSON.parse(a)}catch(d){}else"object"===typeof a?b=a:C("Unable to modify a Model from: "+a);var c=b.incremental;"number"!==typeof c&&C("Unable to apply non-incremental changes to Model: "+a);0!==c&&(this.xa("applyIncrementalJson"),this.lq(b),this.Xa("applyIncrementalJson"))};t.fz=function(a){return this.wx(a)};
Z.constructGraphLinksModel=function(){return new Z};t=Z.prototype;
t.nm=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];if(za(d)){var e=c;d=this.nm(d);Array.isArray(a)?a[e]=d:C("Cannot replace an object in an HTMLCollection or NodeList at "+e)}}else if(za(a)){for(b in a)if(c=a[b],za(c)&&(c=this.nm(c),a[b]=c,"points"===b&&Array.isArray(c))){e=0===c.length%2;for(d=0;d<c.length;d++)if("number"!==typeof c[d]){e=!1;break}if(e){e=new F;for(d=0;d<c.length/2;d++)e.add(new J(c[2*d],c[2*d+1]));e.freeze();a[b]=e}}return $q(a)}return a};
t.Em=function(a){return void 0===a?"undefined":null===a?"null":!0===a?"true":!1===a?"false":"string"===typeof a?this.quote(a):"number"===typeof a?Infinity===a?"9e9999":-Infinity===a?"-9e9999":isNaN(a)?'{"class":"NaN"}':a.toString():a instanceof Date?'{"class":"Date", "value":"'+a.toJSON()+'"}':a instanceof Number?this.Em(a.valueOf()):Aa(a)?Xq(this,a):za(a)?Wq(this,a):"function"===typeof a?"null":a.toString()};
function Xq(a,b,c){void 0===c&&(c=!1);var d=b.length;if(0>=d)return"[]";var e=new Wa;e.add("[");c&&1<d&&e.add("\n");for(var f=0;f<d;f++){var g=b[f];void 0!==g&&(0<f&&(e.add(","),c&&e.add("\n")),e.add(a.Em(g)))}c&&1<d&&e.add("\n");e.add("]");return e.toString()}function Vq(a,b){return void 0===b||"__gohashid"===a||"_"===a[0]||"function"===typeof b?!0:!1}function ar(a){return isNaN(a)?"NaN":Infinity===a?"9e9999":-Infinity===a?"-9e9999":a}
function Wq(a,b){var c=b;if(c instanceof J)b={"class":"go.Point",x:ar(c.x),y:ar(c.y)};else if(c instanceof Fb)b={"class":"go.Size",width:ar(c.width),height:ar(c.height)};else if(c instanceof M)b={"class":"go.Rect",x:ar(c.x),y:ar(c.y),width:ar(c.width),height:ar(c.height)};else if(c instanceof kc)b={"class":"go.Margin",top:ar(c.top),right:ar(c.right),bottom:ar(c.bottom),left:ar(c.left)};else if(c instanceof N)c.hb()?b={"class":"go.Spot",x:ar(c.x),y:ar(c.y),offsetX:ar(c.offsetX),offsetY:ar(c.offsetY)}:
b={"class":"go.Spot","enum":c.toString()};else if(c instanceof gl){b={"class":"go.Brush",type:c.type.name};if(c.type===nl)b.color=c.color;else if(c.type===ql||c.type===hl)b.start=c.start,b.end=c.end,c.type===hl&&(0!==c.startRadius&&(b.startRadius=ar(c.startRadius)),isNaN(c.endRadius)||(b.endRadius=ar(c.endRadius)));if(null!==c.colorStops){var d={};for(c=c.colorStops.iterator;c.next();)d[c.key]=c.value;b.colorStops=d}}else c instanceof P?(b={"class":"go.Geometry",type:c.type.name},0!==c.startX&&(b.startX=
ar(c.startX)),0!==c.startY&&(b.startY=ar(c.startY)),0!==c.endX&&(b.endX=ar(c.endX)),0!==c.endY&&(b.endY=ar(c.endY)),c.spot1.A(tc)||(b.spot1=c.spot1),c.spot2.A(Bc)||(b.spot2=c.spot2),c.type===P.o&&(b.path=P.wa(c))):c instanceof D&&(b={"class":"go.EnumValue",classType:Zq(a,c.classType),name:c.name});d="{";c=!0;for(var e in b){var f=gn(b,e);if(!Vq(e,f))if(c?c=!1:d+=",",d+=a.quote(e)+":","points"===e&&f instanceof F){var g="[";for(f=f.iterator;f.next();){var h=f.value;1<g.length&&(g+=",");g+=a.Em(h.x);
g+=",";g+=a.Em(h.y)}g+="]";d+=g}else d+=a.Em(f)}return d+"}"}function br(a){return"number"===typeof a?a:"NaN"===a?NaN:"9e9999"===a?Infinity:"-9e9999"===a?-Infinity:parseFloat(a)}
function $q(a){if("object"!==typeof a)return a;var b=a["class"]||"";if("NaN"===b)return NaN;if("Date"===b)return new Date(a.value);if(0!==b.indexOf("go."))return a;b=b.substr(3);var c=a;if("Point"===b)c=new J(br(a.x),br(a.y));else if("Size"===b)c=new Fb(br(a.width),br(a.height));else if("Rect"===b)c=new M(br(a.x),br(a.y),br(a.width),br(a.height));else if("Margin"===b)c=new kc(br(a.top),br(a.right),br(a.bottom),br(a.left));else if("Spot"===b)"string"===typeof a["enum"]?c=gd(a["enum"]):c=new N(br(a.x),
br(a.y),br(a.offsetX),br(a.offsetY));else if("Brush"===b){if(c=new gl,c.type=Va(gl,a.type),"string"===typeof a.color&&(c.color=a.color),a.start instanceof N&&(c.start=a.start),a.end instanceof N&&(c.end=a.end),"number"===typeof a.startRadius&&(c.startRadius=br(a.startRadius)),"number"===typeof a.endRadius&&(c.endRadius=br(a.endRadius)),a=a.colorStops,za(a))for(var d in a)c.addColorStop(parseFloat(d),a[d])}else"Geometry"===b?(c=null,"string"===typeof a.path?c=P.parse(a.path):c=new P,c.type=Va(P,a.type),
"number"===typeof a.startX&&(c.startX=br(a.startX)),"number"===typeof a.startY&&(c.startY=br(a.startY)),"number"===typeof a.endX&&(c.endX=br(a.endX)),"number"===typeof a.endY&&(c.endY=br(a.endY)),a.spot1 instanceof N&&(c.spot1=a.spot1),a.spot2 instanceof N&&(c.spot2=a.spot2)):"EnumValue"===b&&(d=a.classType,0===d.indexOf("go.")&&(d=d.substr(3)),d=dr(d),"function"===typeof d&&(c=Va(d,a.name)));return c}t.yh=function(a){this.Ot.add(a);return this};t.pk=function(a){this.Ot.remove(a)};
t.js=function(a){this.skipsUndoManager||this.undoManager.Yu(a);for(var b=this.Ot,c=b.length,d=0;d<c;d++)b.J(d)(a)};t.Wa=function(a,b,c,d,e,f,g){er(this,"",a,b,c,d,e,f,g)};t.g=function(a,b,c,d,e){er(this,"",ge,a,this,b,c,d,e)};t.Ns=function(a,b,c,d,e,f){er(this,"",ge,b,a,c,d,e,f)};function er(a,b,c,d,e,f,g,h,k){void 0===h&&(h=null);void 0===k&&(k=null);var l=new fe;l.model=a;l.change=c;l.modelChange=b;l.propertyName=d;l.object=e;l.oldValue=f;l.oldParam=h;l.newValue=g;l.newParam=k;a.js(l)}
Z.prototype.changeState=function(a,b){if(null!==a&&a.model===this)if(a.change===ge){var c=a.object,d=a.propertyName,e=a.H(b);d===this.nodeKeyProperty&&this.cb(c)&&(b=a.H(!b),void 0!==b&&this.bb.remove(b),void 0!==e&&this.bb.add(e,c));Hj(c,d,e)}else a.change===ie?(c=a.newParam,"nodeDataArray"===a.modelChange?(a=a.newValue,za(a)&&"number"===typeof c&&(d=this.pa(a),b?(this.Gc[c]===a&&Fa(this.Gc,c),void 0!==d&&this.bb.remove(d)):(this.Gc[c]!==a&&Ea(this.Gc,c,a),void 0!==d&&this.bb.add(d,a)))):""===a.modelChange?
((d=a.object)&&!Aa(d)&&a.propertyName&&(d=gn(a.object,a.propertyName)),Aa(d)&&"number"===typeof c&&(a=a.newValue,b?Fa(d,c):Ea(d,c,a))):C("unknown ChangedEvent.Insert modelChange: "+a.toString())):a.change===pe?(c=a.oldParam,"nodeDataArray"===a.modelChange?(a=a.oldValue,za(a)&&"number"===typeof c&&(d=this.pa(a),b?(this.Gc[c]!==a&&Ea(this.Gc,c,a),void 0!==d&&this.bb.add(d,a)):(this.Gc[c]===a&&Fa(this.Gc,c),void 0!==d&&this.bb.remove(d)))):""===a.modelChange?((d=a.object)&&!Aa(d)&&a.propertyName&&(d=
gn(a.object,a.propertyName)),Aa(d)&&"number"===typeof c&&(a=a.oldValue,b?Ea(d,c,a):Fa(d,c))):C("unknown ChangedEvent.Remove modelChange: "+a.toString())):a.change!==he&&C("unknown ChangedEvent: "+a.toString())};Z.prototype.xa=function(a){return this.undoManager.xa(a)};Z.prototype.Xa=function(a){return this.undoManager.Xa(a)};Z.prototype.Hf=function(){return this.undoManager.Hf()};
Z.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.xa(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.Xa(b):this.undoManager.Hf(),this.skipsUndoManager=c}};t=Z.prototype;t.Fa=function(a,b){void 0===b&&(b="");er(this,"SourceChanged",he,b,a,null,null)};
t.pa=function(a){if(null!==a){var b=this.ni;if(""!==b&&(b=gn(a,b),void 0!==b)){if(Hq(b))return b;C("Key value for node data "+a+" is not a number or a string: "+b)}}};t.um=function(a,b){if(null!==a){var c=this.ni;if(""!==c)if(this.cb(a)){var d=gn(a,c);d!==b&&null===this.Yb(b)&&(Hj(a,c,b),void 0!==d&&this.bb.remove(d),this.bb.add(b,a),er(this,"nodeKey",ge,c,a,d,b),"string"===typeof c&&this.Fa(a,c),this.qq(d,b))}else Hj(a,c,b)}};function Hq(a){return"number"===typeof a||"string"===typeof a}
t.cb=function(a){var b=this.pa(a);return void 0===b?!1:this.bb.H(b)===a};t.Yb=function(a){null===a&&C("Model.findNodeDataForKey:key must not be null");return void 0!==a&&Hq(a)?this.bb.H(a):null};
t.jv=function(a){if(null!==a){var b=this.ni;if(""!==b){var c=this.pa(a);if(void 0===c||this.bb.contains(c)){var d=this.ll;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.bb.contains(c))){Hj(a,b,c);return}if("string"===typeof c){for(d=2;this.bb.contains(c+d);)d++;Hj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.bb.count-1;this.bb.contains(c);)c--;Hj(a,b,c)}}}}};t.sf=function(a){null!==a&&(jb(a),this.cb(a)||zq(this,a,!0))};
function zq(a,b,c){var d=a.pa(b);if(void 0===d||a.bb.H(d)!==b)a.jv(b),d=a.pa(b),void 0===d&&C("Model.makeNodeDataKeyUnique failed on "+b+".  Data not added to Model."),a.bb.add(d,b),d=null,c&&(d=a.Gc.length,Ea(a.Gc,d,b)),er(a,"nodeDataArray",ie,"nodeDataArray",a,null,b,null,d),a.pm(b),a.om(b)}t.bz=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.sf(a[c]);else for(a=a.iterator;a.next();)this.sf(a.value)};t.mm=function(a){null!==a&&yq(this,a,!0)};
function yq(a,b,c){var d=a.pa(b);void 0!==d&&a.bb.remove(d);d=null;if(c){a:if(c=a.Gc,Array.isArray(c))d=c.indexOf(b);else{d=c.length;for(var e=0;e<d;e++)if(c[e]===b){d=e;break a}d=-1}if(0>d)return;Fa(a.Gc,d)}er(a,"nodeDataArray",pe,"nodeDataArray",a,b,null,d,null);a.xq(b)}t.JA=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.mm(a[c]);else for(a=a.iterator;a.next();)this.mm(a.value)};
t.wA=function(a){if(a!==this.nodeDataArray&&Aa(a)){var b=this.tl;b.clear();b.addAll(this.bb.iteratorKeys);var c=this.rl;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.pa(f);if(void 0!==g){c.add(g);var h=this.Yb(g);h!==f&&(null!==h?(this.Mp(h,f),this.vm(f,h)):(f=this.cloneDeep(f),this.um(f,g),this.sf(f)))}else g=this.cloneDeep(f),this.sf(g),c.add(this.pa(g))}for(a=b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.Yb(d))&&this.mm(d);b.clear();c.clear()}};
t.qq=function(a,b){void 0!==b&&(a=Kq(this,a),a instanceof G&&this.Pf.add(b,a))};t.Uv=function(){};t.pm=function(){};t.om=function(){};t.xq=function(){};function Mq(a,b,c){if(void 0!==b){var d=a.Pf.H(b);null===d&&(d=new G,a.Pf.add(b,d));d.add(c)}}function Lq(a,b,c){if(void 0!==b){var d=a.Pf.H(b);d instanceof G&&(void 0===c||null===c?a.Pf.remove(b):(d.remove(c),0===d.count&&a.Pf.remove(b)))}}function Kq(a,b){if(void 0===b)return null;a=a.Pf.H(b);return a instanceof G?a:null}
t.mz=function(a){void 0===a?this.Pf.clear():this.Pf.remove(a)};Z.prototype.copyNodeData=function(a){if(null===a)return null;var b=this.Ik;a=null!==b?b(a,this):fr(this,a,!0);za(a)&&Ua(a);return a};
function fr(a,b,c){if(a.copiesArrays&&Array.isArray(b)){var d=[];for(c=0;c<b.length;c++){var e=fr(a,b[c],a.copiesArrayObjects);d.push(e)}Ua(d);return d}if(c&&za(b)){c=(c=b.constructor)?new c:{};e=a.copiesKey||"string"!==typeof a.nodeKeyProperty?null:a.nodeKeyProperty;for(d in b)if("__gohashid"===d)c.__gohashid=void 0;else if(d===e)c[e]=void 0;else{var f=gn(b,d),g=Zq(a,f);"GraphObject"===g||"Diagram"===g||"Layer"===g||"RowColumnDefinition"===g||"AnimationManager"===g||"Tool"===g||"CommandHandler"===
g||"Layout"===g||"InputEvent"===g||"DiagramEvent"===g||f instanceof Z||f instanceof re||f instanceof qe||f instanceof fe?Hj(c,d,f):(f=fr(a,f,!1),Hj(c,d,f))}Ua(c);return c}return b instanceof J?b.copy():b instanceof Fb?b.copy():b instanceof M?b.copy():b instanceof N?b.copy():b instanceof kc?b.copy():b}
Z.prototype.setDataProperty=function(a,b,c){if(this.cb(a)){if(b===this.nodeKeyProperty){this.um(a,c);return}if(b===this.nodeCategoryProperty){this.tm(a,c);return}}else!gr&&a instanceof Y&&(gr=!0,ya('Model.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),ya("  Is that really your intent?"));var d=gn(a,b);d!==c&&(Hj(a,b,c),this.Ns(a,b,d,c))};t=Z.prototype;t.set=function(a,b,c){this.setDataProperty(a,b,c)};
t.Mp=function(a,b){if(b){var c=this.cb(a),d;for(d in b)"__gohashid"===d||c&&d===this.nodeKeyProperty||this.setDataProperty(a,d,b[d])}};t.Yy=function(a,b){this.xs(a,-1,b)};t.xs=function(a,b,c){0>b&&(b=a.length);Ea(a,b,c);er(this,"",ie,"",a,null,c,null,b)};t.zv=function(a,b){void 0===b&&(b=-1);a===this.Gc&&C("Model.removeArrayItem should not be called on the Model.nodeDataArray");-1===b&&(b=a.length-1);var c=a[b];Fa(a,b);er(this,"",pe,"",a,c,null,b,null)};
t.Yp=function(a){if(null===a)return"";var b=this.yj;if(""===b)return"";b=gn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;C("getCategoryForNodeData found a non-string category for "+a+": "+b)};t.tm=function(a,b){if(null!==a){var c=this.yj;if(""!==c)if(this.cb(a)){var d=gn(a,c);void 0===d&&(d="");d!==b&&(Hj(a,c,b),er(this,"nodeCategory",ge,c,a,d,b))}else Hj(a,c,b)}};t.vm=function(a,b){this.tm(b,this.Yp(a))};t.dm=function(){return!1};t.bk=function(){return!1};t.Pi=function(){return!1};
t.Cs=function(){return!1};t.ck=function(){return!1};function ki(){return new Z}function Zq(a,b){if("function"===typeof b){if(b.className)return b.className;if(b.name)return b.name}else if("object"===typeof b&&null!==b&&b.constructor)return Zq(a,b.constructor);return typeof b}function dr(a){return hr[a]?hr[a]:void 0!==x.go&&x.go[a]?x.go[a]:null}
function gn(a,b){if(!a||!b)return null;try{if("function"===typeof b)var c=b(a);else"function"===typeof a.getAttribute?(c=a.getAttribute(b),null===c&&(c=void 0)):c=a[b]}catch(d){}return c}function Hj(a,b,c){if(a&&b)try{"function"===typeof b?b(a,c):"function"===typeof a.setAttribute?a.setAttribute(b,c):a[b]=c}catch(d){}}
na.Object.defineProperties(Z.prototype,{name:{get:function(){return this.na},set:function(a){var b=this.na;b!==a&&(this.na=a,this.g("name",b,a))}},dataFormat:{get:function(){return this.kn},set:function(a){var b=this.kn;b!==a&&(this.kn=a,this.g("dataFormat",b,a))}},isReadOnly:{get:function(){return this.Rg},set:function(a){var b=this.Rg;b!==a&&(this.Rg=a,this.g("isReadOnly",b,a))}},modelData:{
get:function(){return this.j},set:function(a){var b=this.j;b!==a&&(this.j=a,this.g("modelData",b,a),this.Fa(a))}},undoManager:{get:function(){return this.o},set:function(a){var b=this.o;b!==a&&(null!==b&&b.py(this),this.o=a,null!==a&&a.ux(this))}},skipsUndoManager:{get:function(){return this.kh},set:function(a){this.kh=a}},nodeKeyProperty:{get:function(){return this.ni},set:function(a){var b=this.ni;
b!==a&&(""===a&&C("Model.nodeKeyProperty may not be the empty string"),0<this.bb.count&&C("Cannot set Model.nodeKeyProperty when there is existing node data"),this.ni=a,this.g("nodeKeyProperty",b,a))}},makeUniqueKeyFunction:{get:function(){return this.ll},set:function(a){var b=this.ll;b!==a&&(this.ll=a,this.g("makeUniqueKeyFunction",b,a))}},nodeDataArray:{get:function(){return this.Gc},set:function(a){var b=this.Gc;if(b!==a){this.bb.clear();
this.Uv();for(var c=a.length,d=0;d<c;d++){var e=a[d];za(e)||C("Model.nodeDataArray must only contain Objects, not: "+e);jb(e)}this.Gc=a;d=new F;for(e=0;e<c;e++){var f=a[e],g=this.pa(f);void 0===g?d.add(f):null!==this.bb.H(g)?d.add(f):this.bb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.jv(e),f=this.pa(e),void 0!==f&&this.bb.add(f,e);er(this,"nodeDataArray",ge,"nodeDataArray",this,b,a);for(b=0;b<c;b++)d=a[b],this.pm(d),this.om(d);Array.isArray(a)||(this.isReadOnly=!0)}}},copyNodeDataFunction:{
get:function(){return this.Ik},set:function(a){var b=this.Ik;b!==a&&(this.Ik=a,this.g("copyNodeDataFunction",b,a))}},copiesArrays:{get:function(){return this.bn},set:function(a){var b=this.bn;b!==a&&(this.bn=a,this.g("copiesArrays",b,a))}},copiesArrayObjects:{get:function(){return this.an},set:function(a){var b=this.an;b!==a&&(this.an=a,this.g("copiesArrayObjects",b,a))}},copiesKey:{get:function(){return this.dn},
set:function(a){var b=this.dn;b!==a&&(this.dn=a,this.g("copiesKey",b,a))}},afterCopyFunction:{get:function(){return this.Nm},set:function(a){var b=this.Nm;b!==a&&(this.Nm=a,this.g("afterCopyFunction",b,a))}},nodeCategoryProperty:{get:function(){return this.yj},set:function(a){var b=this.yj;b!==a&&(this.yj=a,this.g("nodeCategoryProperty",b,a))}},type:{get:function(){return"Model"}}});
Z.prototype.setCategoryForNodeData=Z.prototype.tm;Z.prototype.getCategoryForNodeData=Z.prototype.Yp;Z.prototype.removeArrayItem=Z.prototype.zv;Z.prototype.insertArrayItem=Z.prototype.xs;Z.prototype.addArrayItem=Z.prototype.Yy;Z.prototype.assignAllDataProperties=Z.prototype.Mp;Z.prototype.set=Z.prototype.set;Z.prototype.clearUnresolvedReferences=Z.prototype.mz;Z.prototype.mergeNodeDataArray=Z.prototype.wA;Z.prototype.removeNodeDataCollection=Z.prototype.JA;Z.prototype.removeNodeData=Z.prototype.mm;
Z.prototype.addNodeDataCollection=Z.prototype.bz;Z.prototype.addNodeData=Z.prototype.sf;Z.prototype.makeNodeDataKeyUnique=Z.prototype.jv;Z.prototype.findNodeDataForKey=Z.prototype.Yb;Z.prototype.containsNodeData=Z.prototype.cb;Z.prototype.setKeyForNodeData=Z.prototype.um;Z.prototype.getKeyForNodeData=Z.prototype.pa;Z.prototype.updateTargetBindings=Z.prototype.Fa;Z.prototype.commit=Z.prototype.commit;Z.prototype.rollbackTransaction=Z.prototype.Hf;Z.prototype.commitTransaction=Z.prototype.Xa;
Z.prototype.startTransaction=Z.prototype.xa;Z.prototype.raiseDataChanged=Z.prototype.Ns;Z.prototype.raiseChanged=Z.prototype.g;Z.prototype.raiseChangedEvent=Z.prototype.Wa;Z.prototype.removeChangedListener=Z.prototype.pk;Z.prototype.addChangedListener=Z.prototype.yh;Z.prototype.writeJsonValue=Z.prototype.Em;Z.prototype.replaceJsonObjects=Z.prototype.nm;Z.prototype.applyIncrementalJSON=Z.prototype.fz;Z.prototype.applyIncrementalJson=Z.prototype.wx;Z.prototype.toJSON=Z.prototype.toJSON;
Z.prototype.toJson=Z.prototype.uq;Z.prototype.toIncrementalJSON=Z.prototype.VA;Z.prototype.toIncrementalJson=Z.prototype.By;Z.prototype.toIncrementalData=Z.prototype.UA;Z.prototype.clear=Z.prototype.clear;var gr=!1,hr={};Z.className="Model";
Z.fromJSON=Z.fromJson=function(a,b){void 0===b&&(b=null);var c=null;if("string"===typeof a)try{c=x.JSON.parse(a)}catch(f){}else"object"===typeof a?c=a:C("Unable to construct a Model from: "+a);if(null===b){a=null;var d=c["class"];if("string"===typeof d)try{var e=null;0===d.indexOf("go.")?(d=d.substr(3),e=dr(d)):(e=dr(d),null===e&&(e=x[d]));"function"===typeof e&&(a=new e)}catch(f){}null===a||a instanceof Z?b=a:C("Unable to construct a Model of declared class: "+c["class"])}null===b&&(b=Z.constructGraphLinksModel());
b.mq(c);b.wv(c);return b};Z.safePropertyValue=gn;Z.safePropertySet=Hj;hr.Brush=gl;hr.ChangedEvent=fe;hr.Geometry=P;hr.Margin=kc;hr.Panel=X;hr.Point=J;hr.Rect=M;hr.Size=Fb;hr.Spot=N;hr.Transaction=qe;hr.UndoManager=re;function si(a,b,c,d){Ua(this);this.v=!1;void 0===a&&(a="");void 0===b&&(b=a);void 0===c&&(c=null);this.j=-1;this.pd=null;this.Ol=a;this.Nl=this.xp=0;this.Tr=null;this.Yn=!1;this.Gl=b;this.$m=c;void 0===d?(this.ol=ir,this.Bk=null):(this.ol=$m,this.Bk=d);this.Et=new G}
si.prototype.copy=function(){var a=new si;a.Ol=this.Ol;a.xp=this.xp;a.Nl=this.Nl;a.Tr=this.Tr;a.Yn=this.Yn;a.Gl=this.Gl;a.$m=this.$m;a.ol=this.ol;a.Bk=this.Bk;return a};t=si.prototype;t.gb=function(a){a.classType===si&&(this.mode=a)};t.toString=function(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(-1!==this.Xi?" "+this.Xi:"")+" "+this.mode.name+")"};t.freeze=function(){this.v=!0;return this};t.ea=function(){this.v=!1;return this};
t.hy=function(a){void 0===a&&(a=null);this.mode=$m;this.backConverter=a;return this};t.jq=function(a){void 0===a&&(a="");this.sourceName=a;this.isToModel=!1;return this};t.zA=function(){this.sourceName=null;this.isToModel=!0;return this};function $k(a,b,c){a=a.sourceName;return null===a||""===a?b:"/"===a?c.part:"."===a?c:".."===a?c.panel:b.Ya(a)}
t.Vv=function(a,b,c){var d=this.Gl;if(void 0===c||""===d||d===c){c=this.Ol;var e=this.$m;if(null===e&&""===c)ya("Binding error: target property is the empty string: "+this.toString());else{var f=b;""!==d&&(f=gn(b,d));if(void 0!==f)if(null===e)""!==c&&Hj(a,c,f);else try{if(""!==c){var g=e(f,a);Hj(a,c,g)}else e(f,a)}catch(h){}}}};
t.zq=function(a,b,c,d){if(this.ol===$m){var e=this.Ol;if(void 0===c||e===c){c=this.Gl;var f=this.Bk,g=a;""!==e&&(g=gn(a,e));if(void 0!==g&&!this.Et.contains(a))try{this.Et.add(a);var h=null!==d?d.diagram:null,k=null!==h?h.model:null;if(null===f)if(""!==c)null!==k?k.setDataProperty(b,c,g):Hj(b,c,g);else{if(null!==k&&null!==d&&0<=d.itemIndex&&null!==d.panel&&Array.isArray(d.panel.itemArray)){var l=d.itemIndex,m=d.panel.itemArray;k.zv(m,l);k.xs(m,l,g)}}else try{if(""!==c){var n=f(g,b,k);null!==k?k.setDataProperty(b,
c,n):Hj(b,c,n)}else{var p=f(g,b,k);if(void 0!==p&&null!==k&&null!==d&&0<=d.itemIndex&&null!==d.panel&&Array.isArray(d.panel.itemArray)){var r=d.itemIndex,q=d.panel.itemArray;k.zv(q,r);k.xs(q,r,p)}}}catch(u){}}finally{this.Et.remove(a)}}}};
na.Object.defineProperties(si.prototype,{Xi:{get:function(){return this.j},set:function(a){this.v&&wa(this);this.j=a}},targetProperty:{get:function(){return this.Ol},set:function(a){this.v&&wa(this);this.Ol=a}},sourceName:{get:function(){return this.Tr},set:function(a){this.v&&wa(this);this.Tr=a;null!==a&&(this.Yn=!1)}},isToModel:{get:function(){return this.Yn},set:function(a){this.v&&
wa(this);this.Yn=a}},sourceProperty:{get:function(){return this.Gl},set:function(a){this.v&&wa(this);this.Gl=a}},converter:{get:function(){return this.$m},set:function(a){this.v&&wa(this);this.$m=a}},backConverter:{get:function(){return this.Bk},set:function(a){this.v&&wa(this);this.Bk=a}},mode:{get:function(){return this.ol},set:function(a){this.v&&wa(this);this.ol=a}}});
si.prototype.updateSource=si.prototype.zq;si.prototype.updateTarget=si.prototype.Vv;si.prototype.ofModel=si.prototype.zA;si.prototype.ofObject=si.prototype.jq;si.prototype.makeTwoWay=si.prototype.hy;var Ck="Binding",ir=new D(si,"OneWay",1),$m=new D(si,"TwoWay",2);si.className="Binding";si.parseEnum=function(a,b){return function(c){c=Va(a,c);return null===c?b:c}};si.toString=La;si.OneWay=ir;si.TwoWay=$m;
function jr(a,b,c){Z.call(this);this.vw=',\n  "insertedLinkKeys": ';this.Hy=',\n  "modifiedLinkData": ';this.xw=',\n  "removedLinkKeys": ';this.Zc=[];this.Vf=new G;this.kb=new I;this.hi="";this.bj=this.Hk=this.ml=null;this.af="from";this.bf="to";this.uj=this.tj="";this.sj="category";this.ce="";this.sl="isGroup";this.Ae="group";this.cn=!1;void 0!==b&&(this.linkDataArray=b);void 0!==a&&(Aa(a)?this.nodeDataArray=a:Object.assign(this,a));c&&Object.assign(this,c)}ma(jr,Z);jr.constructGraphLinksModel=Z.constructGraphLinksModel;
jr.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.hi=this.hi;a.ml=this.ml;a.Hk=this.Hk;a.af=this.af;a.bf=this.bf;a.tj=this.tj;a.uj=this.uj;a.sj=this.sj;a.ce=this.ce;a.sl=this.sl;a.Ae=this.Ae;a.cn=this.cn};t=jr.prototype;t.clear=function(){Z.prototype.clear.call(this);this.Zc=[];this.kb.clear();this.Vf.clear()};
t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.uq();var b=(""!==this.name?this.name:"")+" GraphLinksModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;var c=a.length,d;for(d=0;d<c;d++){var e=a[d];b+=" "+this.pa(e)+":"+La(e)}b+="\n link data:";a=this.linkDataArray;c=a.length;for(d=0;d<c;d++)e=a[d],b+=" "+Fq(this,e,!0)+"--\x3e"+Fq(this,e,!1)}return b};
t.aw=function(a,b){""===this.linkKeyProperty&&C("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalData() to succeed.");var c=Z.prototype.aw.call(this,a,b),d=this,e=new G,f=new G,g=new G,h=this.Mh;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===ie?e.add(a.newValue):a.change===pe&&g.add(a.oldValue):d.xc(a.object)?f.add(a.object):null!==a.object&&(null!==a.object&&h&&h.contains(a.object)?h.get(a.object).each(function(a){d.xc(a)&&f.add(a)}):
a.object instanceof Z||d.cb(a.object)||kr(d,a.object).each(function(a){f.add(a)})))});var k=this.rl;k.clear();e.each(function(a){k.add(d.pc(a));b||f.add(a)});var l=this.tl;l.clear();g.each(function(a){l.add(d.pc(a));b&&f.add(a)});a=d.cloneDeep(f.ya());0<k.count&&(null===c&&(c={}),b?c.removedLinkKeys=k.ya():c.insertedLinkKeys=k.ya());0<a.length&&(null===c&&(c={}),c.modifiedLinkData=a);0<l.count&&(null===c&&(c={}),b?c.insertedLinkKeys=l.ya():c.removedLinkKeys=l.ya());l.clear();k.clear();return c};
t.Dm=function(){var a=Z.prototype.Dm.call(this),b="";"category"!==this.linkCategoryProperty&&"string"===typeof this.linkCategoryProperty&&(b+=',\n  "linkCategoryProperty": '+this.quote(this.linkCategoryProperty));""!==this.linkKeyProperty&&"string"===typeof this.linkKeyProperty&&(b+=',\n  "linkKeyProperty": '+this.quote(this.linkKeyProperty));"from"!==this.linkFromKeyProperty&&"string"===typeof this.linkFromKeyProperty&&(b+=',\n  "linkFromKeyProperty": '+this.quote(this.linkFromKeyProperty));"to"!==
this.linkToKeyProperty&&"string"===typeof this.linkToKeyProperty&&(b+=',\n  "linkToKeyProperty": '+this.quote(this.linkToKeyProperty));""!==this.linkFromPortIdProperty&&"string"===typeof this.linkFromPortIdProperty&&(b+=',\n  "linkFromPortIdProperty": '+this.quote(this.linkFromPortIdProperty));""!==this.linkToPortIdProperty&&"string"===typeof this.linkToPortIdProperty&&(b+=',\n  "linkToPortIdProperty": '+this.quote(this.linkToPortIdProperty));""!==this.linkLabelKeysProperty&&"string"===typeof this.linkLabelKeysProperty&&
(b+=',\n  "linkLabelKeysProperty": '+this.quote(this.linkLabelKeysProperty));"isGroup"!==this.nodeIsGroupProperty&&"string"===typeof this.nodeIsGroupProperty&&(b+=',\n  "nodeIsGroupProperty": '+this.quote(this.nodeIsGroupProperty));"group"!==this.nodeGroupKeyProperty&&"string"===typeof this.nodeGroupKeyProperty&&(b+=',\n  "nodeGroupKeyProperty": '+this.quote(this.nodeGroupKeyProperty));return a+b};
t.mq=function(a){Z.prototype.mq.call(this,a);a.linkKeyProperty&&(this.linkKeyProperty=a.linkKeyProperty);a.linkFromKeyProperty&&(this.linkFromKeyProperty=a.linkFromKeyProperty);a.linkToKeyProperty&&(this.linkToKeyProperty=a.linkToKeyProperty);a.linkFromPortIdProperty&&(this.linkFromPortIdProperty=a.linkFromPortIdProperty);a.linkToPortIdProperty&&(this.linkToPortIdProperty=a.linkToPortIdProperty);a.linkCategoryProperty&&(this.linkCategoryProperty=a.linkCategoryProperty);a.linkLabelKeysProperty&&(this.linkLabelKeysProperty=
a.linkLabelKeysProperty);a.nodeIsGroupProperty&&(this.nodeIsGroupProperty=a.nodeIsGroupProperty);a.nodeGroupKeyProperty&&(this.nodeGroupKeyProperty=a.nodeGroupKeyProperty)};t.bw=function(){var a=Z.prototype.bw.call(this),b=',\n  "linkDataArray": '+Xq(this,this.linkDataArray,!0);return a+b};t.wv=function(a){Z.prototype.wv.call(this,a);a=a.linkDataArray;Array.isArray(a)&&(this.nm(a),this.linkDataArray=a)};
function kr(a,b){for(var c=new G,d=0;d<a.linkDataArray.length;d++){var e=a.linkDataArray[d];Yq(a,b,e,e,c)}return c}
t.$v=function(a,b){""===this.linkKeyProperty&&C("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalJson() to succeed.");var c=Z.prototype.$v.call(this,a,b),d=this,e=new G,f=new G,g=new G,h=this.Mh;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===ie?e.add(a.newValue):a.change===pe&&g.add(a.oldValue):d.xc(a.object)?f.add(a.object):null!==a.object&&(null!==a.object&&h&&h.contains(a.object)?h.get(a.object).each(function(a){d.xc(a)&&f.add(a)}):
a.object instanceof Z||d.cb(a.object)||kr(d,a.object).each(function(a){f.add(a)})))});var k=this.rl;k.clear();e.each(function(a){k.add(d.pc(a));b||f.add(a)});var l=this.tl;l.clear();g.each(function(a){l.add(d.pc(a));b&&f.add(a)});a=c;0<k.count&&(a+=(b?this.xw:this.vw)+Xq(this,k.ya(),!0));0<f.count&&(a+=this.Hy+Xq(this,f.ya(),!0));0<l.count&&(a+=(b?this.vw:this.xw)+Xq(this,l.ya(),!0));l.clear();k.clear();return a};
t.lq=function(a){(void 0!==a.linkCategoryProperty&&a.linkCategoryProperty!==this.linkCategoryProperty||void 0!==a.linkKeyProperty&&a.linkKeyProperty!==this.linkKeyProperty||void 0!==a.linkFromKeyProperty&&a.linkFromKeyProperty!==this.linkFromKeyProperty||void 0!==a.linkToKeyProperty&&a.linkToKeyProperty!==this.linkToKeyProperty||void 0!==a.linkFromPortIdProperty&&a.linkFromPortIdProperty!==this.linkFromPortIdProperty||void 0!==a.linkToPortIdProperty&&a.linkToPortIdProperty!==this.linkToPortIdProperty||
void 0!==a.linkLabelKeysProperty&&a.linkLabelKeysProperty!==this.linkLabelKeysProperty||void 0!==a.nodeIsGroupProperty&&a.nodeIsGroupProperty!==this.nodeIsGroupProperty||void 0!==a.nodeGroupKeyProperty&&a.nodeGroupKeyProperty!==this.nodeGroupKeyProperty)&&C("applyIncrementalJson cannot change Model properties");Z.prototype.lq.call(this,a);var b=a.insertedLinkKeys;if(Array.isArray(b))for(var c=b.length,d=0;d<c;d++){var e=b[d],f=this.Dh(e);null===f&&(f=this.Rp({}),this.Rs(f,e),this.Bi(f))}b=a.modifiedLinkData;
if(Array.isArray(b))for(c=b.length,d=0;d<c;d++)if(e=b[d],f=this.pc(e),f=this.Dh(f),null!==f){for(var g in e)"__gohashid"!==g&&g!==this.linkKeyProperty&&this.setDataProperty(f,g,e[g]);lr(this,e,f)}a=a.removedLinkKeys;if(Array.isArray(a))for(g=a.length,b=0;b<g;b++)c=this.Dh(a[b]),null!==c&&this.lm(c)};
jr.prototype.changeState=function(a,b){if(null!==a&&a.model===this){if(a.change===ge){var c=a.object,d=a.propertyName;if(d===this.linkKeyProperty&&this.xc(c)){var e=a.H(b);b=a.H(!b);void 0!==b&&this.kb.remove(b);void 0!==e&&this.kb.add(e,c);Hj(c,d,e);return}}else if(a.change===ie){c=a.newParam;if("linkDataArray"===a.modelChange){a=a.newValue;za(a)&&"number"===typeof c&&(d=this.pc(a),b?(this.Vf.remove(a),this.Zc[c]===a&&this.Zc.splice(c,1),void 0!==d&&this.kb.remove(d)):(this.Vf.add(a),this.Zc[c]!==
a&&this.Zc.splice(c,0,a),void 0!==d&&this.kb.add(d,a)));return}if("linkLabelKeys"===a.modelChange){d=this.Bf(a.object);Array.isArray(d)&&"number"===typeof c&&(b?(c=d.indexOf(a.newValue),0<=c&&d.splice(c,1)):0>d.indexOf(a.newValue)&&d.splice(c,0,a.newValue));return}}else if(a.change===pe){c=a.oldParam;if("linkDataArray"===a.modelChange){a=a.oldValue;za(a)&&"number"===typeof c&&(d=this.pc(a),b?(this.Vf.add(a),this.Zc[c]!==a&&this.Zc.splice(c,0,a),void 0!==d&&this.kb.add(d,a)):(this.Vf.remove(a),this.Zc[c]===
a&&this.Zc.splice(c,1),void 0!==d&&this.kb.remove(d)));return}if("linkLabelKeys"===a.modelChange){d=this.Bf(a.object);Array.isArray(d)&&"number"===typeof c&&(b?0>d.indexOf(a.newValue)&&d.splice(c,0,a.newValue):(c=d.indexOf(a.newValue),0<=c&&d.splice(c,1)));return}}Z.prototype.changeState.call(this,a,b)}};t=jr.prototype;t.fm=function(a){if(void 0!==a){var b=this.bj;if(null!==b){var c=this.Yb(a);null===c&&(c=this.copyNodeData(b),Hj(c,this.nodeKeyProperty,a),this.sf(c))}return a}};
t.Tx=function(a){return Fq(this,a,!0)};t.Gv=function(a,b){Nq(this,a,b,!0)};t.Wx=function(a){return Fq(this,a,!1)};t.Kv=function(a,b){Nq(this,a,b,!1)};function Fq(a,b,c){if(null!==b&&(a=c?a.af:a.bf,""!==a&&(a=gn(b,a),void 0!==a))){if(Hq(a))return a;C((c?"FromKey":"ToKey")+" value for link data "+b+" is not a number or a string: "+a)}}
function Nq(a,b,c,d){null===c&&(c=void 0);if(null!==b){var e=d?a.af:a.bf;if(""!==e)if(c=a.fm(c),a.xc(b)){var f=gn(b,e);f!==c&&(Lq(a,f,b),Hj(b,e,c),null===a.Yb(c)&&Mq(a,c,b),er(a,d?"linkFromKey":"linkToKey",ge,e,b,f,c),"string"===typeof e&&a.Fa(b,e))}else Hj(b,e,c)}}t.Ux=function(a){return Eq(this,a,!0)};t.Hv=function(a,b){Oq(this,a,b,!0)};t.Xx=function(a){return Eq(this,a,!1)};t.Lv=function(a,b){Oq(this,a,b,!1)};
function Eq(a,b,c){if(null===b)return"";a=c?a.tj:a.uj;if(""===a)return"";b=gn(b,a);return void 0===b?"":b}function Oq(a,b,c,d){if(null!==b){var e=d?a.tj:a.uj;if(""!==e)if(a.xc(b)){var f=gn(b,e);void 0===f&&(f="");f!==c&&(Hj(b,e,c),er(a,d?"linkFromPortId":"linkToPortId",ge,e,b,f,c),"string"===typeof e&&a.Fa(b,e))}else Hj(b,e,c)}}t.Bf=function(a){if(null===a)return mr;var b=this.ce;if(""===b)return mr;a=gn(a,b);return void 0===a?mr:a};
t.Ss=function(a,b){if(null!==a){var c=this.ce;if(""!==c)if(this.xc(a)){var d=gn(a,c);void 0===d&&(d=mr);if(d!==b){if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)Lq(this,d[f],a);Hj(a,c,b);e=b.length;for(f=0;f<e;f++){var g=b[f];null===this.Yb(g)&&Mq(this,g,a)}er(this,"linkLabelKeys",ge,c,a,d,b);"string"===typeof c&&this.Fa(a,c)}}else Hj(a,c,b)}};
t.tu=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.ce;if(""!==c){var d=gn(a,c);if(void 0===d)c=[],c.push(b),this.Ss(a,c);else if(Array.isArray(d)){var e=d.indexOf(b);0<=e||(e=d.length,d.push(b),this.xc(a)&&(null===this.Yb(b)&&Mq(this,b,a),er(this,"linkLabelKeys",ie,c,a,null,b,null,e)))}else C(c+" property is not an Array; cannot addLabelKeyForLinkData: "+a)}}};
t.oy=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.ce;if(""!==c){var d=gn(a,c);if(Array.isArray(d)){var e=d.indexOf(b);0>e||(d.splice(e,1),this.xc(a)&&(Lq(this,b,a),er(this,"linkLabelKeys",pe,c,a,b,null,e,null)))}else void 0!==d&&C(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}};t.pc=function(a){if(null!==a){var b=this.hi;if(""!==b&&(b=gn(a,b),void 0!==b)){if(Hq(b))return b;C("Key value for link data "+a+" is not a number or a string: "+b)}}};
t.Rs=function(a,b){if(null!==a){var c=this.hi;if(""!==c)if(this.xc(a)){var d=gn(a,c);d!==b&&null===this.Dh(b)&&(Hj(a,c,b),void 0!==d&&this.kb.remove(d),this.kb.add(b,a),er(this,"linkKey",ge,c,a,d,b),"string"===typeof c&&this.Fa(a,c))}else Hj(a,c,b)}};t.Dh=function(a){null===a&&C("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&Hq(a)?this.kb.H(a):null};
t.Hs=function(a){if(null!==a){var b=this.hi;if(""!==b){var c=this.pc(a);if(void 0===c||this.kb.contains(c)){var d=this.ml;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.kb.contains(c))){Hj(a,b,c);return}if("string"===typeof c){for(d=2;this.kb.contains(c+d);)d++;Hj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.kb.count-1;this.kb.contains(c);)c--;Hj(a,b,c)}}}}};t.xc=function(a){return null===a?!1:this.Vf.contains(a)};t.Bi=function(a){null!==a&&(jb(a),this.xc(a)||Jq(this,a,!0))};
function Jq(a,b,c){if(""!==a.linkKeyProperty){var d=a.pc(b);if(void 0!==d&&a.kb.H(d)===b)return;a.Hs(b);d=a.pc(b);void 0===d&&C("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");a.kb.add(d,b)}a.Vf.add(b);d=null;c&&(d=a.Zc.length,a.Zc.splice(d,0,b));er(a,"linkDataArray",ie,"linkDataArray",a,null,b,null,d);nr(a,b)}t.az=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.Bi(a[c]);else for(a=a.iterator;a.next();)this.Bi(a.value)};
t.lm=function(a){null!==a&&Iq(this,a,!0)};function Iq(a,b,c){a.Vf.remove(b);var d=a.pc(b);void 0!==d&&a.kb.remove(d);d=null;if(c){d=a.Zc.indexOf(b);if(0>d)return;a.Zc.splice(d,1)}er(a,"linkDataArray",pe,"linkDataArray",a,b,null,d,null);c=Fq(a,b,!0);Lq(a,c,b);c=Fq(a,b,!1);Lq(a,c,b);d=a.Bf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],Lq(a,c,b)}t.HA=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.lm(a[c]);else for(a=a.iterator;a.next();)this.lm(a.value)};
t.vA=function(a){""===this.linkKeyProperty&&C("GraphLinksModel.linkKeyProperty must not be an empty string for .mergeLinkDataArray() to succeed.");if(a!==this.linkDataArray&&Aa(a)){var b=this.tl;b.clear();b.addAll(this.kb.iteratorKeys);var c=this.rl;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.pc(f);if(void 0!==g){c.add(g);var h=this.Dh(g);h!==f&&(null!==h?(this.Mp(h,f),lr(this,f,h)):(f=this.cloneDeep(f),this.Rs(f,g),this.Bi(f)))}else g=this.cloneDeep(f),this.Bi(g),c.add(this.pc(g))}for(a=
b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.Dh(d))&&this.lm(d);b.clear();c.clear()}};function nr(a,b){var c=Fq(a,b,!0);c=a.fm(c);null===a.Yb(c)&&Mq(a,c,b);c=Fq(a,b,!1);c=a.fm(c);null===a.Yb(c)&&Mq(a,c,b);var d=a.Bf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],null===a.Yb(c)&&Mq(a,c,b)}
t.Rp=function(a){if(null===a)return null;var b=this.Hk;a=null!==b?b(a,this):fr(this,a,!0);za(a)&&(Ua(a),""!==this.af&&Hj(a,this.af,void 0),""!==this.bf&&Hj(a,this.bf,void 0),""!==this.ce&&Hj(a,this.ce,[]));return a};t.dv=function(a){if(null===a)return!1;var b=this.sl;return""===b?!1:gn(a,b)?!0:!1};t.Eh=function(a){if(null!==a){var b=this.Ae;if(""!==b&&(b=gn(a,b),void 0!==b)){if(Hq(b))return b;C("GroupKey value for node data "+a+" is not a number or a string: "+b)}}};
t.tq=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.Ae;if(""!==c)if(this.cb(a)){var d=gn(a,c);d!==b&&(Lq(this,d,a),Hj(a,c,b),null===this.Yb(b)&&Mq(this,b,a),er(this,"nodeGroupKey",ge,c,a,d,b),"string"===typeof c&&this.Fa(a,c))}else Hj(a,c,b)}};jr.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.Rj||""===this.Ae||void 0===gn(a,this.Ae)||Hj(a,this.Ae,void 0);return a};
jr.prototype.setDataProperty=function(a,b,c){if(this.cb(a)){if(b===this.nodeKeyProperty){this.um(a,c);return}if(b===this.nodeCategoryProperty){this.tm(a,c);return}if(b===this.nodeGroupKeyProperty){this.tq(a,c);return}}else if(this.xc(a)){if(b===this.linkFromKeyProperty){Nq(this,a,c,!0);return}if(b===this.linkToKeyProperty){Nq(this,a,c,!1);return}if(b===this.linkFromPortIdProperty){Oq(this,a,c,!0);return}if(b===this.linkToPortIdProperty){Oq(this,a,c,!1);return}if(b===this.linkKeyProperty){this.Rs(a,
c);return}if(b===this.linkCategoryProperty){this.sq(a,c);return}if(b===this.linkLabelKeysProperty){this.Ss(a,c);return}}var d=gn(a,b);d!==c&&(Hj(a,b,c),this.Ns(a,b,d,c))};t=jr.prototype;t.Mp=function(a,b){if(b){var c=this.cb(a),d=this.xc(a),e;for(e in b)"__gohashid"===e||c&&e===this.nodeKeyProperty||c&&e===this.nodeIsGroupProperty&&gn(a,e)===b[e]||d&&e===this.linkKeyProperty||this.setDataProperty(a,e,b[e])}};
t.qq=function(a,b){Z.prototype.qq.call(this,a,b);for(var c=this.bb.iterator;c.next();)this.Bv(c.value,a,b);for(c=this.Vf.iterator;c.next();){var d=c.value,e=a,f=b;if(Fq(this,d,!0)===e){var g=this.af;Hj(d,g,f);er(this,"linkFromKey",ge,g,d,e,f);"string"===typeof g&&this.Fa(d,g)}Fq(this,d,!1)===e&&(g=this.bf,Hj(d,g,f),er(this,"linkToKey",ge,g,d,e,f),"string"===typeof g&&this.Fa(d,g));g=this.Bf(d);if(Array.isArray(g))for(var h=g.length,k=this.ce,l=0;l<h;l++)g[l]===e&&(g[l]=f,er(this,"linkLabelKeys",ie,
k,d,e,f,l,l))}};t.Bv=function(a,b,c){if(this.Eh(a)===b){var d=this.Ae;Hj(a,d,c);er(this,"nodeGroupKey",ge,d,a,b,c);"string"===typeof d&&this.Fa(a,d)}};t.Uv=function(){Z.prototype.Uv.call(this);for(var a=this.linkDataArray,b=a.length,c=0;c<b;c++)nr(this,a[c])};
t.pm=function(a){Z.prototype.pm.call(this,a);a=this.pa(a);var b=Kq(this,a);if(null!==b){var c=Ga();for(b=b.iterator;b.next();){var d=b.value;if(this.cb(d)){if(this.Eh(d)===a){var e=this.Ae;er(this,"nodeGroupKey",ge,e,d,a,a);"string"===typeof e&&this.Fa(d,e);c.push(d)}}else if(Fq(this,d,!0)===a&&(e=this.af,er(this,"linkFromKey",ge,e,d,a,a),"string"===typeof e&&this.Fa(d,e),c.push(d)),Fq(this,d,!1)===a&&(e=this.bf,er(this,"linkToKey",ge,e,d,a,a),"string"===typeof e&&this.Fa(d,e),c.push(d)),e=this.Bf(d),
Array.isArray(e))for(var f=e.length,g=this.ce,h=0;h<f;h++)e[h]===a&&(er(this,"linkLabelKeys",ie,g,d,a,a,h,h),c.push(d))}for(b=0;b<c.length;b++)Lq(this,a,c[b]);Ja(c)}};t.om=function(a){Z.prototype.om.call(this,a);var b=this.Eh(a);null===this.Yb(b)&&Mq(this,b,a)};t.xq=function(a){Z.prototype.xq.call(this,a);var b=this.Eh(a);Lq(this,b,a)};
t.ts=function(a){if(null===a)return"";var b=this.sj;if(""===b)return"";b=gn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;C("getCategoryForLinkData found a non-string category for "+a+": "+b)};jr.prototype.getLinkCategoryForData=function(a){return this.ts(a)};jr.prototype.sq=function(a,b){if(null!==a){var c=this.sj;if(""!==c)if(this.xc(a)){var d=gn(a,c);void 0===d&&(d="");d!==b&&(Hj(a,c,b),er(this,"linkCategory",ge,c,a,d,b),"string"===typeof c&&this.Fa(a,c))}else Hj(a,c,b)}};
jr.prototype.setLinkCategoryForData=function(a,b){this.sq(a,b)};t=jr.prototype;t.vm=function(a,b){Z.prototype.vm.call(this,a,b);this.tq(b,this.Eh(a))};function lr(a,b,c){a.sq(c,a.ts(b));a.Gv(c,a.Tx(b));a.Kv(c,a.Wx(b));a.Ss(c,a.Bf(b));a.Hv(c,a.Ux(b));a.Lv(c,a.Xx(b))}t.bk=function(){return!0};t.Pi=function(){return!0};t.Cs=function(){return!0};t.ck=function(){return!0};
na.Object.defineProperties(jr.prototype,{archetypeNodeData:{get:function(){return this.bj},set:function(a){var b=this.bj;b!==a&&(this.bj=a,this.g("archetypeNodeData",b,a))}},linkFromKeyProperty:{get:function(){return this.af},set:function(a){var b=this.af;b!==a&&(this.af=a,this.g("linkFromKeyProperty",b,a))}},linkToKeyProperty:{get:function(){return this.bf},set:function(a){var b=this.bf;b!==a&&(this.bf=a,this.g("linkToKeyProperty",
b,a))}},linkFromPortIdProperty:{get:function(){return this.tj},set:function(a){var b=this.tj;b!==a&&(this.tj=a,this.g("linkFromPortIdProperty",b,a))}},linkToPortIdProperty:{get:function(){return this.uj},set:function(a){var b=this.uj;b!==a&&(this.uj=a,this.g("linkToPortIdProperty",b,a))}},linkLabelKeysProperty:{get:function(){return this.ce},set:function(a){var b=this.ce;b!==a&&(this.ce=a,this.g("linkLabelKeysProperty",
b,a))}},linkDataArray:{get:function(){return this.Zc},set:function(a){var b=this.Zc;if(b!==a){this.kb.clear();for(var c=a.length,d=0;d<c;d++){var e=a[d];za(e)||C("GraphLinksModel.linkDataArray must only contain Objects, not: "+e);jb(e)}this.Zc=a;if(""!==this.linkKeyProperty){d=new F;for(e=0;e<c;e++){var f=a[e],g=this.pc(f);void 0===g?d.add(f):null!==this.kb.H(g)?d.add(f):this.kb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.Hs(e),f=this.pc(e),void 0!==f&&this.kb.add(f,
e)}d=new G;for(e=0;e<c;e++)d.add(a[e]);this.Vf=d;er(this,"linkDataArray",ge,"linkDataArray",this,b,a);for(b=0;b<c;b++)nr(this,a[b])}}},linkKeyProperty:{get:function(){return this.hi},set:function(a){var b=this.hi;if(b!==a){this.hi=a;this.kb.clear();for(var c=this.linkDataArray.length,d=0;d<c;d++){var e=this.linkDataArray[d],f=this.pc(e);void 0===f&&(this.Hs(e),f=this.pc(e));void 0!==f&&this.kb.add(f,e)}this.g("linkKeyProperty",b,a)}}},makeUniqueLinkKeyFunction:{
get:function(){return this.ml},set:function(a){var b=this.ml;b!==a&&(this.ml=a,this.g("makeUniqueLinkKeyFunction",b,a))}},copyLinkDataFunction:{get:function(){return this.Hk},set:function(a){var b=this.Hk;b!==a&&(this.Hk=a,this.g("copyLinkDataFunction",b,a))}},nodeIsGroupProperty:{get:function(){return this.sl},set:function(a){var b=this.sl;b!==a&&(this.sl=a,this.g("nodeIsGroupProperty",b,a))}},nodeGroupKeyProperty:{
get:function(){return this.Ae},set:function(a){var b=this.Ae;b!==a&&(this.Ae=a,this.g("nodeGroupKeyProperty",b,a))}},Rj:{get:function(){return this.cn},set:function(a){this.cn!==a&&(this.cn=a)}},linkCategoryProperty:{get:function(){return this.sj},set:function(a){var b=this.sj;b!==a&&(this.sj=a,this.g("linkCategoryProperty",b,a))}},type:{get:function(){return"GraphLinksModel"}}});
jr.prototype.setCategoryForLinkData=jr.prototype.sq;jr.prototype.getCategoryForLinkData=jr.prototype.ts;jr.prototype.assignAllDataProperties=jr.prototype.Mp;jr.prototype.setGroupKeyForNodeData=jr.prototype.tq;jr.prototype.getGroupKeyForNodeData=jr.prototype.Eh;jr.prototype.isGroupForNodeData=jr.prototype.dv;jr.prototype.copyLinkData=jr.prototype.Rp;jr.prototype.mergeLinkDataArray=jr.prototype.vA;jr.prototype.removeLinkDataCollection=jr.prototype.HA;jr.prototype.removeLinkData=jr.prototype.lm;
jr.prototype.addLinkDataCollection=jr.prototype.az;jr.prototype.addLinkData=jr.prototype.Bi;jr.prototype.containsLinkData=jr.prototype.xc;jr.prototype.makeLinkDataKeyUnique=jr.prototype.Hs;jr.prototype.findLinkDataForKey=jr.prototype.Dh;jr.prototype.setKeyForLinkData=jr.prototype.Rs;jr.prototype.getKeyForLinkData=jr.prototype.pc;jr.prototype.removeLabelKeyForLinkData=jr.prototype.oy;jr.prototype.addLabelKeyForLinkData=jr.prototype.tu;jr.prototype.setLabelKeysForLinkData=jr.prototype.Ss;
jr.prototype.getLabelKeysForLinkData=jr.prototype.Bf;jr.prototype.setToPortIdForLinkData=jr.prototype.Lv;jr.prototype.getToPortIdForLinkData=jr.prototype.Xx;jr.prototype.setFromPortIdForLinkData=jr.prototype.Hv;jr.prototype.getFromPortIdForLinkData=jr.prototype.Ux;jr.prototype.setToKeyForLinkData=jr.prototype.Kv;jr.prototype.getToKeyForLinkData=jr.prototype.Wx;jr.prototype.setFromKeyForLinkData=jr.prototype.Gv;jr.prototype.getFromKeyForLinkData=jr.prototype.Tx;jr.prototype.clear=jr.prototype.clear;
var mr=Object.freeze([]);jr.className="GraphLinksModel";hr.GraphLinksModel=jr;Z.constructGraphLinksModel=Z.constructGraphLinksModel=function(){return new jr};Z.initDiagramModel=ki=function(){return new jr};function or(a,b){Z.call(this);this.Be="parent";this.en=!1;this.Aj="parentLinkCategory";void 0!==a&&(Aa(a)?this.nodeDataArray=a:Object.assign(this,a));b&&Object.assign(this,b)}ma(or,Z);or.constructGraphLinksModel=Z.constructGraphLinksModel;
or.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.Be=this.Be;a.en=this.en;a.Aj=this.Aj};t=or.prototype;t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.uq();var b=(""!==this.name?this.name:"")+" TreeModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.pa(e)+":"+La(e)}}return b};
t.Dm=function(){var a=Z.prototype.Dm.call(this),b="";"parent"!==this.nodeParentKeyProperty&&"string"===typeof this.nodeParentKeyProperty&&(b+=',\n  "nodeParentKeyProperty": '+this.quote(this.nodeParentKeyProperty));return a+b};t.mq=function(a){Z.prototype.mq.call(this,a);a.nodeParentKeyProperty&&(this.nodeParentKeyProperty=a.nodeParentKeyProperty)};
t.lq=function(a){void 0!==a.nodeParentKeyProperty&&a.nodeParentKeyProperty!==this.nodeParentKeyProperty&&C("applyIncrementalJson cannot change Model properties");Z.prototype.lq.call(this,a)};t.fm=function(a){return a};t.Fh=function(a){if(null!==a){var b=this.Be;if(""!==b&&(b=gn(a,b),void 0!==b)){if(Hq(b))return b;C("ParentKey value for node data "+a+" is not a number or a string: "+b)}}};
t.he=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.Be;if(""!==c)if(b=this.fm(b),this.cb(a)){var d=gn(a,c);d!==b&&(Lq(this,d,a),Hj(a,c,b),null===this.Yb(b)&&Mq(this,b,a),er(this,"nodeParentKey",ge,c,a,d,b),"string"===typeof c&&this.Fa(a,c))}else Hj(a,c,b)}};t.ws=function(a){if(null===a)return"";var b=this.Aj;if(""===b)return"";b=gn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;C("getParentLinkCategoryForNodeData found a non-string category for "+a+": "+b);return""};
or.prototype.getLinkCategoryForData=function(a){return this.ws(a)};or.prototype.Ts=function(a,b){if(null!==a){var c=this.Aj;if(""!==c)if(this.cb(a)){var d=gn(a,c);void 0===d&&(d="");d!==b&&(Hj(a,c,b),er(this,"parentLinkCategory",ge,c,a,d,b),"string"===typeof c&&this.Fa(a,c))}else Hj(a,c,b)}};or.prototype.setLinkCategoryForData=function(a,b){this.Ts(a,b)};
or.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.Sj||""===this.Be||void 0===gn(a,this.Be)||Hj(a,this.Be,void 0);return a};or.prototype.setDataProperty=function(a,b,c){if(this.cb(a)){if(b===this.nodeKeyProperty){this.um(a,c);return}if(b===this.nodeCategoryProperty){this.tm(a,c);return}if(b===this.nodeParentKeyProperty){this.he(a,c);return}}var d=gn(a,b);d!==c&&(Hj(a,b,c),this.Ns(a,b,d,c))};t=or.prototype;
t.qq=function(a,b){Z.prototype.qq.call(this,a,b);for(var c=this.bb.iterator;c.next();)this.Bv(c.value,a,b)};t.Bv=function(a,b,c){if(this.Fh(a)===b){var d=this.Be;Hj(a,d,c);er(this,"nodeParentKey",ge,d,a,b,c);"string"===typeof d&&this.Fa(a,d)}};
t.pm=function(a){Z.prototype.pm.call(this,a);a=this.pa(a);var b=Kq(this,a);if(null!==b){var c=Ga();for(b=b.iterator;b.next();){var d=b.value;if(this.cb(d)&&this.Fh(d)===a){var e=this.Be;er(this,"nodeParentKey",ge,e,d,a,a);"string"===typeof e&&this.Fa(d,e);c.push(d)}}for(b=0;b<c.length;b++)Lq(this,a,c[b]);Ja(c)}};t.om=function(a){Z.prototype.om.call(this,a);var b=this.Fh(a);b=this.fm(b);null===this.Yb(b)&&Mq(this,b,a)};t.xq=function(a){Z.prototype.xq.call(this,a);var b=this.Fh(a);Lq(this,b,a)};
t.vm=function(a,b){Z.prototype.vm.call(this,a,b);this.Ts(b,this.ws(a));this.he(b,this.Fh(a))};t.dm=function(){return!0};t.Cs=function(){return!0};
na.Object.defineProperties(or.prototype,{nodeParentKeyProperty:{get:function(){return this.Be},set:function(a){var b=this.Be;b!==a&&(this.Be=a,this.g("nodeParentKeyProperty",b,a))}},Sj:{get:function(){return this.en},set:function(a){this.en!==a&&(this.en=a)}},parentLinkCategoryProperty:{get:function(){return this.Aj},set:function(a){var b=this.Aj;b!==a&&(this.Aj=a,this.g("parentLinkCategoryProperty",b,a))}},
linkCategoryProperty:{get:function(){return this.parentLinkCategoryProperty},set:function(a){this.parentLinkCategoryProperty=a}},type:{get:function(){return"TreeModel"}}});or.prototype.setParentLinkCategoryForNodeData=or.prototype.Ts;or.prototype.getParentLinkCategoryForNodeData=or.prototype.ws;or.prototype.setParentKeyForNodeData=or.prototype.he;or.prototype.getParentKeyForNodeData=or.prototype.Fh;or.className="TreeModel";hr.TreeModel=or;
function pr(a){mi.call(this);this.Kw=this.sn=this.bc=0;this.Vq=360;this.Jw=qr;this.fj=0;this.zw=new J;this.Nq=this.de=0;this.es=new rr;this.tt=this.zj=0;this.Ry=600;this.So=NaN;this.Sm=1;this.tp=0;this.Ll=360;this.Hb=qr;this.K=sr;this.ad=tr;this.Tc=iq;this.jf=6;this.Co=ur;a&&Object.assign(this,a)}ma(pr,mi);
pr.prototype.cloneProtected=function(a){mi.prototype.cloneProtected.call(this,a);a.So=this.So;a.Sm=this.Sm;a.tp=this.tp;a.Ll=this.Ll;a.Hb=this.Hb;a.K=this.K;a.ad=this.ad;a.Tc=this.Tc;a.jf=this.jf;a.Co=this.Co};
pr.prototype.gb=function(a){if(a.classType===pr)if(a===vr||a===wr||a===xr||a===yr||a===tr)this.sorting=a;else if(a===zr||a===Ar||a===sr||a===Br)this.direction=a;else if(a===Cr||a===Dr||a===qr||a===Er)this.arrangement=a;else{if(a===Fr||a===ur)this.nodeDiameterFormula=a}else mi.prototype.gb.call(this,a)};pr.prototype.createNetwork=function(){return new Gr(this)};
pr.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);a=this.network.vertexes;if(1>=a.count)1===a.count&&(a=a.first(),a.centerX=0,a.centerY=0);else{var b=new F;b.addAll(a.iterator);a=new F;var c=new F;var d=this.sort(b);var e,f,g=this.Nq;var h=this.arrangement;var k=this.nodeDiameterFormula;var l=this.radius;if(!isFinite(l)||0>=l)l=NaN;var m=this.aspectRatio;if(!isFinite(m)||0>=m)m=1;var n=this.startAngle;
isFinite(n)||(n=0);var p=this.sweepAngle;if(!isFinite(p)||360<p||1>p)p=360;b=this.spacing;isFinite(b)||(b=NaN);h===Er&&k===Fr?h=qr:h===Er&&k!==Fr&&(h=this.arrangement);if((this.direction===zr||this.direction===Ar)&&this.sorting!==tr){for(k=0;!(k>=d.length);k+=2){a.add(d.J(k));if(k+1>=d.length)break;c.add(d.J(k+1))}this.direction===zr?(this.arrangement===Er&&a.reverse(),d=new F,d.addAll(a),d.addAll(c)):(this.arrangement===Er&&c.reverse(),d=new F,d.addAll(c),d.addAll(a))}k=d.length;for(var r=f=e=0;r<
d.length;r++){var q=n+p*f*(this.direction===sr?1:-1)/k,u=d.J(r).diameter;isNaN(u)&&(u=Hr(d.J(r),q));360>p&&(0===r||r===d.length-1)&&(u/=2);e+=u;f++}if(isNaN(l)||h===Er){isNaN(b)&&(b=6);if(h!==qr&&h!==Er){f=-Infinity;for(g=0;g<k;g++)r=d.J(g),e=d.J(g===k-1?0:g+1),isNaN(r.diameter)&&Hr(r,0),isNaN(e.diameter)&&Hr(e,0),f=Math.max(f,(r.diameter+e.diameter)/2);g=f+b;h===Cr?l=(f+b)/(2*Math.PI/k):l=Ir(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180)}else l=Ir(this,e+(360<=p?k:k-1)*(h!==Er?b:1.6*b),m,n*
Math.PI/180,p*Math.PI/180);f=l*m}else if(f=l*m,r=Jr(this,l,f,n*Math.PI/180,p*Math.PI/180),isNaN(b)){if(h===qr||h===Er)b=(r-e)/(360<=p?k:k-1)}else if(h===qr||h===Er)r=(r-e)/(360<=p?k:k-1),r<b?(l=Ir(this,e+b*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180),f=l*m):b=r;else{g=-Infinity;for(e=0;e<k;e++)q=d.J(e),u=d.J(e===k-1?0:e+1),isNaN(q.diameter)&&Hr(q,0),isNaN(u.diameter)&&Hr(u,0),g=Math.max(g,(q.diameter+u.diameter)/2);g+=b;e=Ir(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180);e>l?(l=e,f=l*m):g=
r/(360<=p?k:k-1)}this.Jw=h;this.bc=l;this.sn=m;this.Kw=n;this.Vq=p;this.fj=b;this.de=f;this.Nq=g;b=d;d=this.Jw;h=this.bc;l=this.Kw;m=this.Vq;n=this.fj;p=this.de;k=this.Nq;if(this.direction!==zr&&this.direction!==Ar||d!==Er)if(this.direction===zr||this.direction===Ar){g=0;switch(d){case Dr:g=180*Kr(this,h,p,l,k)/Math.PI;break;case qr:k=b=0;g=a.first();null!==g&&(b=Hr(g,Math.PI/2));g=c.first();null!==g&&(k=Hr(g,Math.PI/2));g=180*Kr(this,h,p,l,n+(b+k)/2)/Math.PI;break;case Cr:g=m/b.length}if(this.direction===
zr){switch(d){case Dr:Lr(this,a,l,Br);break;case qr:Mr(this,a,l,Br);break;case Cr:Nr(this,a,m/2,l,Br)}switch(d){case Dr:Lr(this,c,l+g,sr);break;case qr:Mr(this,c,l+g,sr);break;case Cr:Nr(this,c,m/2,l+g,sr)}}else{switch(d){case Dr:Lr(this,c,l,Br);break;case qr:Mr(this,c,l,Br);break;case Cr:Nr(this,c,m/2,l,Br)}switch(d){case Dr:Lr(this,a,l+g,sr);break;case qr:Mr(this,a,l+g,sr);break;case Cr:Nr(this,a,m/2,l+g,sr)}}}else switch(d){case Dr:Lr(this,b,l,this.direction);break;case qr:Mr(this,b,l,this.direction);
break;case Cr:Nr(this,b,m,l,this.direction);break;case Er:Or(this,b,m,l,this.direction)}else Or(this,b,m,l-m/2,sr)}this.updateParts();this.network=null;this.isValidLayout=!0};function Nr(a,b,c,d,e){var f=a.Vq,g=a.bc;a=a.de;d=d*Math.PI/180;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=d+(e===sr?k*c/(360<=f?h:h-1):-(k*c)/h),m=b.J(k),n=g*Math.tan(l)/a;n=Math.sqrt((g*g+a*a*n*n)/(1+n*n));m.centerX=n*Math.cos(l);m.centerY=n*Math.sin(l);m.actualAngle=180*l/Math.PI}}
function Mr(a,b,c,d){var e=a.bc,f=a.de,g=a.fj;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.J(k),m=b.J(k===h-1?0:k+1),n=f*Math.sin(c);l.centerX=e*Math.cos(c);l.centerY=n;l.actualAngle=180*c/Math.PI;isNaN(l.diameter)&&Hr(l,0);isNaN(m.diameter)&&Hr(m,0);l=Kr(a,e,f,d===sr?c:-c,(l.diameter+m.diameter)/2+g);c+=d===sr?l:-l}}
function Lr(a,b,c,d){var e=a.bc,f=a.de,g=a.Nq;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.J(k);l.centerX=e*Math.cos(c);l.centerY=f*Math.sin(c);l.actualAngle=180*c/Math.PI;l=Kr(a,e,f,d===sr?c:-c,g);c+=d===sr?l:-l}}function Or(a,b,c,d,e){var f=a.Vq;a.zj=0;a.es=new rr;if(360>c){for(f=d+(e===sr?f:-f);0>f;)f+=360;f%=360;180<f&&(f-=360);f*=Math.PI/180;a.tt=f;Pr(a,b,c,d,e)}else Qr(a,b,c,d,e);a.es.commit(b)}
function Qr(a,b,c,d,e){var f=a.bc,g=a.fj,h=a.sn,k=f*Math.cos(d*Math.PI/180),l=a.de*Math.sin(d*Math.PI/180),m=b.ya();if(3===m.length)m[0].centerX=f,m[0].centerY=0,m[1].centerX=m[0].centerX-m[0].width/2-m[1].width/2-g,m[1].y=m[0].y,m[2].centerX=(m[0].centerX+m[1].centerX)/2,m[2].y=m[0].y-m[2].height-g;else if(4===m.length)m[0].centerX=f,m[0].centerY=0,m[2].centerX=-m[0].centerX,m[2].centerY=m[0].centerY,m[1].centerX=0,m[1].y=Math.min(m[0].y,m[2].y)-m[1].height-g,m[3].centerX=0,m[3].y=Math.max(m[0].y+
m[0].height+g,m[2].y+m[2].height+g);else{f=J.alloc();for(var n=0;n<m.length;n++){m[n].centerX=k;m[n].centerY=l;if(n>=m.length-1)break;Rr(a,k,l,m,n,e,f)||Sr(a,k,l,m,n,e,f);k=f.x;l=f.y}J.free(f);a.zj++;if(!(23<a.zj)){k=m[0].centerX;l=m[0].centerY;f=m[m.length-1].centerX;n=m[m.length-1].centerY;var p=Math.abs(k-f)-((m[0].width+m[m.length-1].width)/2+g),r=Math.abs(l-n)-((m[0].height+m[m.length-1].height)/2+g);g=0;1>Math.abs(r)?Math.abs(k-f)<(m[0].width+m[m.length-1].width)/2&&(g=0):g=0<r?r:1>Math.abs(p)?
0:p;k=Math.abs(f)>Math.abs(n)?0<f!==l>n:0<n!==k<f;if(k=e===sr?k:!k)g=-Math.abs(g),g=Math.min(g,-m[m.length-1].width),g=Math.min(g,-m[m.length-1].height);a.es.compare(g,m);1<Math.abs(g)&&(a.bc=8>a.zj?a.bc-g/(2*Math.PI):5>m.length&&10<g?a.bc/2:a.bc-(0<g?1.7:-2.3),a.de=a.bc*h,Qr(a,b,c,d,e))}}}
function Pr(a,b,c,d,e){for(var f=a.bc,g=a.de,h=a.sn,k=f*Math.cos(d*Math.PI/180),l=g*Math.sin(d*Math.PI/180),m=J.alloc(),n=b.ya(),p=0;p<n.length;p++){n[p].centerX=k;n[p].centerY=l;if(p>=n.length-1)break;Rr(a,k,l,n,p,e,m)||Sr(a,k,l,n,p,e,m);k=m.x;l=m.y}J.free(m);a.zj++;if(!(23<a.zj)){k=Math.atan2(l,k);k=e===sr?a.tt-k:k-a.tt;k=Math.abs(k)<Math.abs(k-2*Math.PI)?k:k-2*Math.PI;f=k*(f+g)/2;g=a.es;if(Math.abs(f)<Math.abs(g.$l))for(g.$l=f,g.qk=[],g.Fm=[],k=0;k<n.length;k++)g.qk[k]=n[k].bounds.x,g.Fm[k]=n[k].bounds.y;
1<Math.abs(f)&&(a.bc=8>a.zj?a.bc-f/(2*Math.PI):a.bc-(0<f?1.7:-2.3),a.de=a.bc*h,Pr(a,b,c,d,e))}}function Rr(a,b,c,d,e,f,g){var h=a.bc,k=a.de,l=0;a=(d[e].width+d[e+1].width)/2+a.fj;var m=!1;if(0<=c!==(f===sr)){if(f=b+a,f>h){f=b-a;if(f<-h)return g.x=f,g.y=l,!1;m=!0}}else if(f=b-a,f<-h){f=b+a;if(f>h)return g.x=f,g.y=l,!1;m=!0}l=Math.sqrt(1-Math.min(1,f*f/(h*h)))*k;0>c!==m&&(l=-l);if(Math.abs(c-l)>(d[e].height+d[e+1].height)/2)return g.x=f,g.y=l,!1;g.x=f;g.y=l;return!0}
function Sr(a,b,c,d,e,f,g){var h=a.bc,k=a.de,l=0;a=(d[e].height+d[e+1].height)/2+a.fj;d=!1;if(0<=b!==(f===sr)){if(f=c-a,f<-k){f=c+a;if(f>k){g.x=l;g.y=f;return}d=!0}}else if(f=c+a,f>k){f=c-a;if(f<-k){g.x=l;g.y=f;return}d=!0}l=Math.sqrt(1-Math.min(1,f*f/(k*k)))*h;0>b!==d&&(l=-l);g.x=l;g.y=f}pr.prototype.commitLayout=function(){this.commitNodes();this.isRouting&&this.commitLinks()};
pr.prototype.commitNodes=function(){var a=null!==this.group&&null!==this.group.placeholder&&this.group.isSubGraphExpanded,b=a?this.group.location.copy():null,c=this.actualCenter;a?c=new J(0,0):(c.x=this.arrangementOrigin.x+this.bc,c.y=this.arrangementOrigin.y+this.de);for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;e.x+=c.x;e.y+=c.y;e.commit()}a&&(this.group.Ta(),a=this.group.position.copy(),c=this.group.location.copy(),b=b.ie(c.ie(a)),this.group.move(b),this.zw=b.ie(a))};
pr.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};function Jr(a,b,c,d,e){var f=a.Ry;if(.001>Math.abs(a.sn-1))return void 0!==d&&void 0!==e?e*b:2*Math.PI*b;a=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c;var g=0;var h=void 0!==d&&void 0!==e?e/(f+1):Math.PI/(2*(f+1));for(var k=0,l=0;l<=f;l++){void 0!==d&&void 0!==e?k=d+l*e/f:k=l*Math.PI/(2*f);var m=Math.sin(k);g+=Math.sqrt(1-a*a*m*m)*h}return void 0!==d&&void 0!==e?(b>c?b:c)*g:4*(b>c?b:c)*g}
function Ir(a,b,c,d,e){return b/(void 0!==d&&void 0!==e?Jr(a,1,c,d,e):Jr(a,1,c))}function Kr(a,b,c,d,e){if(.001>Math.abs(a.sn-1))return e/b;var f=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c,g=0;a=2*Math.PI/(700*a.network.vertexes.count);b>c&&(d+=Math.PI/2);for(var h=0;;h++){var k=Math.sin(d+h*a);g+=(b>c?b:c)*Math.sqrt(1-f*f*k*k)*a;if(g>=e)return h*a}}
pr.prototype.sort=function(a){switch(this.sorting){case xr:break;case yr:a.reverse();break;case vr:a.sort(this.comparer);break;case wr:a.sort(this.comparer);a.reverse();break;case tr:return this.Ms(Tr(a));default:C("Invalid sorting type.")}return a};
function Tr(a){for(var b=[],c=0;c<a.length;c++)b.push(0);c=new F;for(var d=0;d<a.length;d++){var e=-1,f=-1;if(0===d)for(var g=0;g<a.length;g++){var h=a.J(g).edgesCount;h>e&&(e=h,f=g)}else for(g=0;g<a.length;g++)h=b[g],h>e&&(e=h,f=g);c.add(a.J(f));b[f]=-1;f=a.J(f);for(g=f.sourceEdges;g.next();)e=a.indexOf(g.value.fromVertex),0>e||0<=b[e]&&b[e]++;for(f=f.destinationEdges;f.next();)e=a.indexOf(f.value.toVertex),0>e||0<=b[e]&&b[e]++}return c}
pr.prototype.Ms=function(a){for(var b=[],c=0;c<a.length;c++){var d=a.J(c);b[c]=[];for(var e,f=d.destinationEdges;f.next();)e=a.indexOf(f.value.toVertex),e!==c&&0>b[c].indexOf(e)&&b[c].push(e);for(d=d.sourceEdges;d.next();)e=a.indexOf(d.value.fromVertex),e!==c&&0>b[c].indexOf(e)&&b[c].push(e)}f=[];for(c=0;c<b.length;c++)f[c]=0;c=[];var g=[],h=[];d=[];e=new F;for(var k=0,l=0;l<b.length;l++){var m=b[l].length;if(1===m)d.push(l);else if(0===m)e.add(a.J(l));else{if(0===k)c.push(l);else{for(var n=m=Infinity,
p=-1,r=[],q=0;q<c.length;q++)0>b[c[q]].indexOf(c[q===c.length-1?0:q+1])&&r.push(q===c.length-1?0:q+1);if(0===r.length)for(q=0;q<c.length;q++)r.push(q);for(q=0;q<r.length;q++){for(var u=r[q],w=b[l],v=0,A=0;A<g.length;A++){var y=f[g[A]],B=f[h[A]];if(y<B){var z=y;y=B}else z=B;if(z<u&&u<=y)for(B=0;B<w.length;B++){var E=w[B];0>c.indexOf(E)||z<f[E]&&f[E]<y||z===f[E]||y===f[E]||v++}else for(B=0;B<w.length;B++)E=w[B],0>c.indexOf(E)||z<f[E]&&f[E]<y&&z!==f[E]&&y!==f[E]&&v++}w=v;for(A=v=0;A<b[l].length;A++)z=
c.indexOf(b[l][A]),0<=z&&(z=Math.abs(u-(z>=u?z+1:z)),v+=z<c.length+1-z?z:c.length+1-z);for(A=0;A<g.length;A++)z=f[g[A]],y=f[h[A]],z>=u&&z++,y>=u&&y++,z>y&&(B=y,y=z,z=B),y-z<(c.length+2)/2===(z<u&&u<=y)&&v++;if(w<m||w===m&&v<n)m=w,n=v,p=u}c.splice(p,0,l);for(m=0;m<c.length;m++)f[c[m]]=m;for(m=0;m<b[l].length;m++)n=b[l][m],0<=c.indexOf(n)&&(g.push(l),h.push(n))}k++}}for(g=c.length;;){f=!0;for(h=0;h<d.length;h++)if(k=d[h],l=b[k][0],m=c.indexOf(l),0<=m){for(p=n=0;p<b[l].length;p++)r=c.indexOf(b[l][p]),
0>r||r===m||(q=r>m?r-m:m-r,n+=r<m!==q>g-q?1:-1);c.splice(0>n?m:m+1,0,k);d.splice(h,1);h--}else f=!1;if(f)break;else c.push(d[0]),d.splice(0,1)}for(b=0;b<c.length;b++)e.add(a.J(c[b]));return e};
na.Object.defineProperties(pr.prototype,{radius:{get:function(){return this.So},set:function(a){this.So!==a&&(0<a||isNaN(a))&&(this.So=a,this.B())}},aspectRatio:{get:function(){return this.Sm},set:function(a){this.Sm!==a&&0<a&&(this.Sm=a,this.B())}},startAngle:{get:function(){return this.tp},set:function(a){this.tp!==a&&(this.tp=a,this.B())}},sweepAngle:{get:function(){return this.Ll},
set:function(a){this.Ll!==a&&(0<a&&360>=a?this.Ll=a:this.Ll=360,this.B())}},arrangement:{get:function(){return this.Hb},set:function(a){this.Hb===a||a!==Er&&a!==qr&&a!==Dr&&a!==Cr||(this.Hb=a,this.B())}},direction:{get:function(){return this.K},set:function(a){this.K===a||a!==sr&&a!==Br&&a!==zr&&a!==Ar||(this.K=a,this.B())}},sorting:{get:function(){return this.ad},set:function(a){this.ad===a||a!==xr&&a!==yr&&
a!==vr&&!wr&&a!==tr||(this.ad=a,this.B())}},comparer:{get:function(){return this.Tc},set:function(a){this.Tc!==a&&(this.Tc=a,this.B())}},spacing:{get:function(){return this.jf},set:function(a){this.jf!==a&&(this.jf=a,this.B())}},nodeDiameterFormula:{get:function(){return this.Co},set:function(a){this.Co===a||a!==ur&&a!==Fr||(this.Co=a,this.B())}},actualXRadius:{get:function(){return this.bc}},
actualYRadius:{get:function(){return this.de}},actualSpacing:{get:function(){return this.fj}},actualCenter:{get:function(){return this.zw}}});
var qr=new D(pr,"ConstantSpacing",0),Dr=new D(pr,"ConstantDistance",1),Cr=new D(pr,"ConstantAngle",2),Er=new D(pr,"Packed",3),sr=new D(pr,"Clockwise",4),Br=new D(pr,"Counterclockwise",5),zr=new D(pr,"BidirectionalLeft",6),Ar=new D(pr,"BidirectionalRight",7),xr=new D(pr,"Forwards",8),yr=new D(pr,"Reverse",9),vr=new D(pr,"Ascending",10),wr=new D(pr,"Descending",11),tr=new D(pr,"Optimized",12),ur=new D(pr,"Pythagorean",13),Fr=new D(pr,"Circular",14);pr.className="CircularLayout";pr.ConstantSpacing=qr;
pr.ConstantDistance=Dr;pr.ConstantAngle=Cr;pr.Packed=Er;pr.Clockwise=sr;pr.Counterclockwise=Br;pr.BidirectionalLeft=zr;pr.BidirectionalRight=Ar;pr.Forwards=xr;pr.Reverse=yr;pr.Ascending=vr;pr.Descending=wr;pr.Optimized=tr;pr.Pythagorean=ur;pr.Circular=Fr;function rr(){this.$l=-Infinity;this.Fm=this.qk=null}
rr.prototype.compare=function(a,b){if(0<a&&0>this.$l||Math.abs(a)<Math.abs(this.$l)&&!(0>a&&0<this.$l))for(this.$l=a,this.qk=[],this.Fm=[],a=0;a<b.length;a++)this.qk[a]=b[a].bounds.x,this.Fm[a]=b[a].bounds.y};rr.prototype.commit=function(a){if(null!==this.qk&&null!==this.Fm)for(var b=0;b<this.qk.length;b++){var c=a.J(b);c.x=this.qk[b];c.y=this.Fm[b]}};rr.className="VertexArrangement";function Gr(a){Op.call(this,a)}ma(Gr,Op);Gr.prototype.createVertex=function(){return new Ur(this)};
Gr.prototype.createEdge=function(){return new Vr(this)};Gr.className="CircularNetwork";function Ur(a){bq.call(this,a);this.D=this.ej=NaN}ma(Ur,bq);
function Hr(a,b){var c=a.network;if(null===c)return NaN;c=c.layout;if(null===c)return NaN;if(c.arrangement===Er)if(c.nodeDiameterFormula===Fr)a.ej=Math.max(a.width,a.height);else{c=Math.abs(Math.sin(b));b=Math.abs(Math.cos(b));if(0===c)return a.width;if(0===b)return a.height;a.ej=Math.min(a.height/c,a.width/b)}else a.ej=c.nodeDiameterFormula===Fr?Math.max(a.width,a.height):Math.sqrt(a.width*a.width+a.height*a.height);return a.ej}
na.Object.defineProperties(Ur.prototype,{diameter:{get:function(){return this.ej},set:function(a){this.ej!==a&&(this.ej=a)}},actualAngle:{get:function(){return this.D},set:function(a){this.D!==a&&(this.D=a)}}});Ur.className="CircularVertex";function Vr(a){cq.call(this,a)}ma(Vr,cq);Vr.className="CircularEdge";
function Wr(a){mi.call(this);this.wh=null;this.bo=0;this.Qd=(new Fb(100,100)).freeze();this.Rm=!1;this.hf=!0;this.kd=!1;this.nl=100;this.vn=1;this.Tf=1E3;this.xo=10;this.To=Math;this.Ok=.05;this.Nk=50;this.Lk=150;this.Mk=0;this.nn=10;this.mn=5;a&&Object.assign(this,a)}ma(Wr,mi);
Wr.prototype.cloneProtected=function(a){mi.prototype.cloneProtected.call(this,a);a.Qd.assign(this.Qd);a.Rm=this.Rm;a.hf=this.hf;a.kd=this.kd;a.nl=this.nl;a.vn=this.vn;a.Tf=this.Tf;a.xo=this.xo;a.To=this.To;a.Ok=this.Ok;a.Nk=this.Nk;a.Lk=this.Lk;a.Mk=this.Mk;a.nn=this.nn;a.mn=this.mn};
Wr.prototype.serializeLayoutProperties=function(a,b){mi.prototype.serializeLayoutProperties.call(this,a,b);a.arrangementSpacing={width:this.arrangementSpacing.width,height:this.arrangementSpacing.height};a.arrangesToOrigin=this.arrangesToOrigin;a.setsPortSpots=this.setsPortSpots;a.comments=this.comments;a.maxIterations=this.maxIterations;a.epsilonDistance=this.epsilonDistance;a.infinityDistance=this.infinityDistance;a.moveLimit=this.moveLimit;a.defaultSpringStiffness=this.defaultSpringStiffness;a.defaultSpringLength=
this.defaultSpringLength;a.defaultElectricalCharge=this.defaultElectricalCharge;a.defaultGravitationalMass=this.defaultGravitationalMass;a.defaultCommentSpringLength=this.defaultCommentSpringLength;a.defaultCommentElectricalCharge=this.defaultCommentElectricalCharge};
Wr.prototype.deserializeLayoutProperties=function(a,b,c,d,e){mi.prototype.deserializeLayoutProperties.call(this,a,b,c,d,e);this.arrangementSpacing=new Fb(a.arrangementSpacing.width,a.arrangementSpacing.height);this.arrangesToOrigin=a.arrangesToOrigin;this.setsPortSpots=a.setsPortSpots;this.comments=a.comments;this.maxIterations=a.maxIterations;this.epsilonDistance=a.epsilonDistance;this.infinityDistance=a.infinityDistance;this.moveLimit=a.moveLimit;this.defaultSpringStiffness=a.defaultSpringStiffness;
this.defaultSpringLength=a.defaultSpringLength;this.defaultElectricalCharge=a.defaultElectricalCharge;this.defaultGravitationalMass=a.defaultGravitationalMass;this.defaultCommentSpringLength=a.defaultCommentSpringLength;this.defaultCommentElectricalCharge=a.defaultCommentElectricalCharge};Wr.prototype.createNetwork=function(){return new Xr(this)};
Wr.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));if(!this.Wv()){a=this.maxIterations;if(0<this.network.vertexes.count){this.network.Sp();for(var b=this.network.vertexes.iterator;b.next();){var c=b.value;c.charge=this.electricalCharge(c);c.mass=this.gravitationalMass(c)}for(b=this.network.edges.iterator;b.next();)c=b.value,c.stiffness=this.springStiffness(c),c.length=this.springLength(c);this.vu();this.bo=0;if(this.needsClusterLayout()){b=this.network;c=b.Ay();
for(var d=c.iterator;d.next();){this.network=d.value;for(var e=this.network.vertexes.iterator;e.next();){var f=e.value;f.Kd=f.vertexes.count;f.Kh=1;f.Qj=null;f.Me=null}Yr(this,0,a)}this.network=b;var g=d=c.iterator;d=this.arrangementSpacing;var h=g.count,k=!0;f=e=0;for(var l=Ga(),m=0;m<h+b.vertexes.count+2;m++)l[m]=null;h=0;g.reset();for(var n=M.alloc();g.next();)if(m=g.value,this.computeBounds(m,n),k)k=!1,e=n.x+n.width/2,f=n.y+n.height/2,l[0]=new J(n.x+n.width+d.width,n.y),l[1]=new J(n.x,n.y+n.height+
d.height),h=2;else{var p=Zr(l,h,e,f,n.width,n.height,d),r=l[p],q=new J(r.x+n.width+d.width,r.y),u=new J(r.x,r.y+n.height+d.height);p+1<h&&l.splice(p+1,0,null);l[p]=q;l[p+1]=u;h++;p=r.x-n.x;r=r.y-n.y;for(m=m.vertexes.iterator;m.next();)q=m.value,q.centerX+=p,q.centerY+=r}M.free(n);for(m=b.vertexes.iterator;m.next();)g=m.value,p=g.bounds,2>h?(e=p.x+p.width/2,f=p.y+p.height/2,l[0]=new J(p.x+p.width+d.width,p.y),l[1]=new J(p.x,p.y+p.height+d.height),h=2):(k=Zr(l,h,e,f,p.width,p.height,d),n=l[k],r=new J(n.x+
p.width+d.width,n.y),p=new J(n.x,n.y+p.height+d.height),k+1<h&&l.splice(k+1,0,null),l[k]=r,l[k+1]=p,h++,g.centerX=n.x+g.width/2,g.centerY=n.y+g.height/2);Ja(l);for(d=c.iterator;d.next();){c=d.value;for(e=c.vertexes.iterator;e.next();)b.ng(e.value);for(c=c.edges.iterator;c.next();)b.Rl(c.value)}}$r(this,a);this.updateParts()}this.nl=a;this.network=null;this.isValidLayout=!0}};
Wr.prototype.needsClusterLayout=function(){if(3>this.network.vertexes.count)return!1;for(var a=0,b=0,c=this.network.vertexes.first().bounds,d=this.network.vertexes.iterator;d.next();){if(d.value.bounds.Mc(c)&&(a++,2<a))return!0;if(10<b)break;b++}return!1};Wr.prototype.computeBounds=function(a,b){var c=!0;for(a=a.vertexes.iterator;a.next();){var d=a.value;c?(c=!1,b.set(d.bounds)):b.Rc(d.bounds)}return b};
function Yr(a,b,c){if(as(a,b)){var d=a.Tf;a.Tf*=1+1/(b+1);var e=bs(a,b),f=Math.max(0,Math.max(Math.min(a.network.vertexes.count,c*(b+1)/11),10));a.maxIterations+=f;Yr(a,b+1,c);$r(a,f);cs(a,e);b=e.vertexes.ya();b.sort(function(a,b){return null===a||null===b||a===b?0:b.Kd-a.Kd});for(c=0;c<b.length;c++)ds(a,b[c]);a.Tf=d}}
function as(a,b){if(10<b||3>a.network.vertexes.count)return!1;a.wh=a.network.vertexes.ya();a=a.wh;a.sort(function(a,b){return null===a||null===b||a===b?0:b.Kd-a.Kd});for(b=a.length-1;0<=b&&1>=a[b].Kd;)b--;return 1<a.length-b}
function bs(a,b){for(var c=a.network,d=new Xr(a),e=0;e<a.wh.length;e++){var f=a.wh[e];if(1<f.Kd){d.ng(f);var g=new es;g.ht=f.Kd;g.lt=f.width;g.gt=f.height;g.ew=f.focus.x;g.fw=f.focus.y;null===f.Me&&(f.Me=new F);f.Me.add(g);f.Ev=f.Me.count-1}else break}for(f=c.edges.iterator;f.next();){var h=f.value;e=h.fromVertex;g=h.toVertex;e.network===d&&g.network===d?d.Rl(h):e.network===d?(h=e.Qj,null===h&&(h=new F,e.Qj=h),h.add(g),e.Kd--,e.Kh+=g.Kh):g.network===d&&(h=g.Qj,null===h&&(h=new F,g.Qj=h),h.add(e),
g.Kd--,g.Kh+=e.Kh)}for(e=d.edges.iterator;e.next();)f=e.value,f.length*=Math.max(1,L.sqrt((f.fromVertex.Kh+f.toVertex.Kh)/(4*b+1)));for(b=d.vertexes.iterator;b.next();){e=b.value;var k=e.Qj;if(null!==k&&0<k.count&&(g=e.Me.J(e.Me.count-1).ht-e.Kd,!(0>=g))){for(var l=h=0,m=k.count-g;m<k.count;m++){var n=k.J(m),p=null;for(f=n.edges.iterator;f.next();){var r=f.value;if(r.Vx(n)===e){p=r;break}}null!==p&&(l+=p.length,h+=n.width*n.height)}f=e.centerX;k=e.centerY;m=e.width;n=e.height;p=e.focus;r=m*n;1>r&&
(r=1);h=L.sqrt((h+r+l*l*4/(g*g))/r);g=(h-1)*m/2;h=(h-1)*n/2;e.bounds=new M(f-p.x-g,k-p.y-h,m+2*g,n+2*h);e.focus=new J(p.x+g,p.y+h)}}a.network=d;return c}function cs(a,b){for(var c=a.network.vertexes.iterator;c.next();){var d=c.value;d.network=b;if(null!==d.Me){var e=d.Me.J(d.Ev);d.Kd=e.ht;var f=e.ew,g=e.fw;d.bounds=new M(d.centerX-f,d.centerY-g,e.lt,e.gt);d.focus=new J(f,g);d.Ev--}}for(c=a.network.edges.iterator;c.next();)c.value.network=b;a.network=b}
function ds(a,b){var c=b.Qj;if(null!==c&&0!==c.count){var d=b.centerX,e=b.centerY,f=b.width,g=b.height;null!==b.Me&&0<b.Me.count&&(g=b.Me.J(0),f=g.lt,g=g.gt);f=L.sqrt(f*f+g*g)/2;for(var h=!1,k=g=0,l=0,m=b.vertexes.iterator;m.next();){var n=m.value;1>=n.Kd?k++:(h=!0,l++,g+=Math.atan2(b.centerY-n.centerY,b.centerX-n.centerX))}if(0!==k)for(0<l&&(g/=l),l=b=0,b=h?2*Math.PI/(k+1):2*Math.PI/k,0===k%2&&(l=b/2),1<c.count&&c.sort(function(a,b){return null===a||null===b||a===b?0:b.width*b.height-a.width*a.height}),
h=0===k%2?0:1,c=c.iterator;c.next();)if(k=c.value,!(1<k.Kd||a.isFixed(k))){m=null;for(n=k.edges.iterator;n.next();){m=n.value;break}n=k.width;var p=k.height;n=L.sqrt(n*n+p*p)/2;m=f+m.length+n;n=g+(b*(h/2>>1)+l)*(0===h%2?1:-1);k.centerX=d+m*Math.cos(n);k.centerY=e+m*Math.sin(n);h++}}}
function Zr(a,b,c,d,e,f,g){var h=9E19,k=-1,l=0;a:for(;l<b;l++){var m=a[l],n=m.x-c,p=m.y-d;n=n*n+p*p;if(n<h){for(p=l-1;0<=p;p--)if(a[p].y>m.y&&a[p].x-m.x<e+g.width)continue a;for(p=l+1;p<b;p++)if(a[p].x>m.x&&a[p].y-m.y<f+g.height)continue a;k=l;h=n}}return k}Wr.prototype.vu=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
Wr.prototype.addComments=function(a){var b=a.node;if(null!==b)for(b=b.Nu();b.next();){var c=b.value;if("Comment"===c.category&&c.isVisible()){var d=this.network.Ji(c);null===d&&(d=this.network.Nj(c));d.charge=this.defaultCommentElectricalCharge;c=null;for(var e=d.destinationEdges;e.next();){var f=e.value;if(f.toVertex===a){c=f;break}}if(null===c)for(e=d.sourceEdges;e.next();)if(f=e.value,f.fromVertex===a){c=f;break}null===c&&(c=this.network.ek(a,d,null));c.length=this.defaultCommentSpringLength}}};
function fs(a,b){var c=a.bounds,d=c.x;a=c.y;var e=c.width;c=c.height;var f=b.bounds,g=f.x;b=f.y;var h=f.width;f=f.height;return d+e<g?a>b+f?(c=d+e-g,a=a-b-f,L.sqrt(c*c+a*a)):a+c<b?(d=d+e-g,a=a+c-b,L.sqrt(d*d+a*a)):g-(d+e):d>g+h?a>b+f?(c=d-g-h,a=a-b-f,L.sqrt(c*c+a*a)):a+c<b?(d=d-g-h,a=a+c-b,L.sqrt(d*d+a*a)):d-(g+h):a>b+f?a-(b+f):a+c<b?b-(a+c):.1}function $r(a,b){a.wh=null;for(b=a.bo+b;a.bo<b&&(a.bo++,gs(a)););a.wh=null}
function gs(a){null===a.wh&&(a.wh=a.network.vertexes.ya());var b=a.wh;if(0>=b.length)return!1;var c=b[0];c.forceX=0;c.forceY=0;for(var d=c.centerX,e=d,f=c=c.centerY,g=1;g<b.length;g++){var h=b[g];h.forceX=0;h.forceY=0;var k=h.centerX;h=h.centerY;d=Math.min(d,k);e=Math.max(e,k);c=Math.min(c,h);f=Math.max(f,h)}(e=e-d>f-c)?b.sort(function(a,b){return null===a||null===b||a===b?0:a.centerX-b.centerX}):b.sort(function(a,b){return null===a||null===b||a===b?0:a.centerY-b.centerY});c=a.Tf;var l=d=h=0;for(f=
0;f<b.length;f++){g=b[f];d=g.bounds;h=g.focus;k=d.x+h.x;var m=d.y+h.y;d=g.charge*a.electricalFieldX(k,m);l=g.charge*a.electricalFieldY(k,m);d+=g.mass*a.gravitationalFieldX(k,m);l+=g.mass*a.gravitationalFieldY(k,m);g.forceX+=d;g.forceY+=l;for(var n=f+1;n<b.length;n++){var p=b[n];if(p!==g){d=p.bounds;h=p.focus;l=d.x+h.x;var r=d.y+h.y;if(k-l>c||l-k>c){if(e)break}else if(m-r>c||r-m>c){if(!e)break}else{var q=fs(g,p);1>q?(d=a.randomNumberGenerator,null===d&&(a.randomNumberGenerator=d=new hs),q=d.random(),
h=d.random(),k>l?(d=Math.abs(p.bounds.right-g.bounds.x),d=(1+d)*q):k<l?(d=Math.abs(p.bounds.x-g.bounds.right),d=-(1+d)*q):(d=Math.max(p.width,g.width),d=(1+d)*q-d/2),m>r?(l=Math.abs(p.bounds.bottom-g.bounds.y),l=(1+l)*h):k<l?(l=Math.abs(p.bounds.y-g.bounds.bottom),l=-(1+l)*h):(l=Math.max(p.height,g.height),l=(1+l)*h-l/2)):(h=-(g.charge*p.charge)/(q*q),d=(l-k)/q*h,l=(r-m)/q*h);g.forceX+=d;g.forceY+=l;p.forceX-=d;p.forceY-=l}}}}for(e=a.network.edges.iterator;e.next();)h=e.value,c=h.fromVertex,f=h.toVertex,
g=c.bounds,k=c.focus,d=g.x+k.x,g=g.y+k.y,m=f.bounds,n=f.focus,k=m.x+n.x,m=m.y+n.y,n=fs(c,f),1>n?(n=a.randomNumberGenerator,null===n&&(a.randomNumberGenerator=n=new hs),h=n.random(),n=n.random(),d=(d>k?1:-1)*(1+(f.width>c.width?f.width:c.width))*h,l=(g>m?1:-1)*(1+(f.height>c.height?f.height:c.height))*n):(h=h.stiffness*(n-h.length),d=(k-d)/n*h,l=(m-g)/n*h),c.forceX+=d,c.forceY+=l,f.forceX-=d,f.forceY-=l;for(e=d=0;e<b.length;e++)c=b[e],a.isFixed(c)?a.moveFixedVertex(c):d=Math.max(d,a.moveVertex(c)||
0);return d>a.epsilonDistance*a.epsilonDistance}Wr.prototype.moveVertex=function(a){var b=a.forceX,c=a.forceY,d=this.moveLimit;b<-d?b=-d:b>d&&(b=d);c<-d?c=-d:c>d&&(c=d);a.centerX+=b;a.centerY+=c;return b*b+c*c};Wr.prototype.moveFixedVertex=function(){};Wr.prototype.commitLayout=function(){this.Iv();this.commitNodes();this.isRouting&&this.commitLinks()};
Wr.prototype.Iv=function(){if(this.setsPortSpots)for(var a=this.network.edges.iterator;a.next();){var b=a.value.link;null!==b&&(b.fromSpot=Tc,b.toSpot=Tc)}};Wr.prototype.commitNodes=function(){var a=0,b=0;if(this.arrangesToOrigin){var c=M.alloc();this.computeBounds(this.network,c);b=this.arrangementOrigin;a=b.x-c.x;b=b.y-c.y;M.free(c)}c=M.alloc();for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;if(0!==a||0!==b)c.assign(e.bounds),c.x+=a,c.y+=b,e.bounds=c;e.commit()}M.free(c)};
Wr.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};Wr.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.Ok:a};Wr.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.Nk:a};Wr.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.Lk:a};Wr.prototype.electricalFieldX=function(){return 0};Wr.prototype.electricalFieldY=function(){return 0};
Wr.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.Mk:a};Wr.prototype.gravitationalFieldX=function(){return 0};Wr.prototype.gravitationalFieldY=function(){return 0};Wr.prototype.isFixed=function(a){return a.isFixed};
na.Object.defineProperties(Wr.prototype,{currentIteration:{get:function(){return this.bo}},arrangementSpacing:{get:function(){return this.Qd},set:function(a){this.Qd.A(a)||(this.Qd.assign(a),this.B())}},arrangesToOrigin:{get:function(){return this.Rm},set:function(a){this.Rm!==a&&(this.Rm=a,this.B())}},setsPortSpots:{get:function(){return this.hf},set:function(a){this.hf!==a&&(this.hf=
a,this.B())}},comments:{get:function(){return this.kd},set:function(a){this.kd!==a&&(this.kd=a,this.B())}},maxIterations:{get:function(){return this.nl},set:function(a){this.nl!==a&&0<=a&&(this.nl=a,this.B())}},epsilonDistance:{get:function(){return this.vn},set:function(a){this.vn!==a&&0<a&&(this.vn=a,this.B())}},infinityDistance:{get:function(){return this.Tf},set:function(a){this.Tf!==
a&&1<a&&(this.Tf=a,this.B())}},moveLimit:{get:function(){return this.xo},set:function(a){this.xo!==a&&1<a&&(this.xo=a,this.B())}},randomNumberGenerator:{get:function(){return this.To},set:function(a){this.To!==a&&(null!==a&&"function"!==typeof a.random&&C('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+a),this.To=a)}},defaultSpringStiffness:{get:function(){return this.Ok},
set:function(a){this.Ok!==a&&(this.Ok=a,this.B())}},defaultSpringLength:{get:function(){return this.Nk},set:function(a){this.Nk!==a&&(this.Nk=a,this.B())}},defaultElectricalCharge:{get:function(){return this.Lk},set:function(a){this.Lk!==a&&(this.Lk=a,this.B())}},defaultGravitationalMass:{get:function(){return this.Mk},set:function(a){this.Mk!==a&&(this.Mk=a,this.B())}},defaultCommentSpringLength:{
get:function(){return this.nn},set:function(a){this.nn!==a&&(this.nn=a,this.B())}},defaultCommentElectricalCharge:{get:function(){return this.mn},set:function(a){this.mn!==a&&(this.mn=a,this.B())}}});Wr.className="ForceDirectedLayout";function es(){this.fw=this.ew=this.gt=this.lt=this.ht=0}es.className="ForceDirectedSubnet";function Xr(a){Op.call(this,a)}ma(Xr,Op);Xr.prototype.createVertex=function(){return new is(this)};Xr.prototype.createEdge=function(){return new js(this)};
Xr.className="ForceDirectedNetwork";function is(a){bq.call(this,a);this.Ba=!1;this.Ma=this.D=NaN;this.Kh=this.Kd=this.wa=this.L=0;this.Me=this.Qj=null;this.Ev=0}ma(is,bq);is.prototype.serializeVertexProperties=function(a,b){bq.prototype.serializeVertexProperties.call(this,a,b);a.isFixed=this.isFixed;a.charge=this.charge;a.mass=this.mass};
is.prototype.deserializeVertexProperties=function(a,b,c,d){bq.prototype.deserializeVertexProperties.call(this,a,b,c,d);this.isFixed=a.isFixed;this.charge=a.charge;this.mass=a.mass};
na.Object.defineProperties(is.prototype,{isFixed:{get:function(){return this.Ba},set:function(a){this.Ba!==a&&(this.Ba=a)}},charge:{get:function(){return this.D},set:function(a){this.D!==a&&(this.D=a)}},mass:{get:function(){return this.Ma},set:function(a){this.Ma!==a&&(this.Ma=a)}},forceX:{get:function(){return this.L},set:function(a){this.L!==a&&(this.L=a)}},forceY:{
get:function(){return this.wa},set:function(a){this.wa!==a&&(this.wa=a)}}});is.className="ForceDirectedVertex";function js(a){cq.call(this,a);this.j=this.o=NaN}ma(js,cq);js.prototype.serializeEdgeProperties=function(a,b){cq.prototype.serializeEdgeProperties.call(this,a,b);a.stiffness=this.stiffness;a.length=this.length};js.prototype.deserializeEdgeProperties=function(a,b,c,d){cq.prototype.deserializeEdgeProperties.call(this,a,b,c,d);this.stiffness=a.stiffness;this.length=a.length};
na.Object.defineProperties(js.prototype,{stiffness:{get:function(){return this.o},set:function(a){this.o!==a&&(this.o=a)}},length:{get:function(){return this.j},set:function(a){this.j!==a&&(this.j=a)}}});js.className="ForceDirectedEdge";function hs(){var a=0;void 0===a&&(a=42);this.seed=a;this.Cy=48271;this.Ey=2147483647;this.Q=44488.07041494893;this.Fy=3399;this.Dy=1/2147483647;this.random()}
hs.prototype.random=function(){var a=this.seed%this.Q*this.Cy-this.seed/this.Q*this.Fy;0<a?this.seed=a:this.seed=a+this.Ey;return this.seed*this.Dy};hs.className="RandomNumberGenerator";
function ks(a){mi.call(this);this.ac=this.be=25;this.K=0;this.Kk=ls;this.il=ms;this.Zk=ns;this.qj=4;this.vk=os;this.ag=15;this.hf=!0;this.jo=4;this.Ea=this.ji=this.ra=-1;this.tc=this.Vg=0;this.Ka=this.xd=this.yd=this.ae=this.Ab=null;this.bh=0;this.yo=this.xj=null;this.Fc=0;this.zo=null;this.Sc=new J;this.ye=[];this.ye.length=100;a&&Object.assign(this,a)}ma(ks,mi);
ks.prototype.cloneProtected=function(a){mi.prototype.cloneProtected.call(this,a);a.be=this.be;a.ac=this.ac;a.K=this.K;a.Kk=this.Kk;a.il=this.il;a.Zk=this.Zk;a.qj=this.qj;a.vk=this.vk;a.ag=this.ag;a.hf=this.hf;a.jo=this.jo};
ks.prototype.serializeLayoutProperties=function(a,b){mi.prototype.serializeLayoutProperties.call(this,a,b);a.layerSpacing=this.layerSpacing;a.columnSpacing=this.columnSpacing;a.direction=this.direction;a.cycleRemoveOption=this.cycleRemoveOption.name;a.layeringOption=this.layeringOption.name;a.initializeOption=this.initializeOption.name;a.iterations=this.iterations;a.aggressiveOption=this.aggressiveOption.name;a.packOption=this.packOption;a.setsPortSpots=this.setsPortSpots;a.linkSpacing=this.linkSpacing;
a.ra=this.ra;a.ji=this.ji;a.Ea=this.Ea;a.Vg=this.Vg;a.tc=this.tc;a.Ab=this.Ab;a.bh=this.bh;a.Fc=this.Fc;a.Sc={x:this.Sc.x,y:this.Sc.y}};
ks.prototype.deserializeLayoutProperties=function(a,b,c,d,e){mi.prototype.deserializeLayoutProperties.call(this,a,b,c,d,e);this.layerSpacing=a.layerSpacing;this.columnSpacing=a.columnSpacing;this.direction=a.direction;this.cycleRemoveOption=Va(ks,a.cycleRemoveOption);this.layeringOption=Va(ks,a.layeringOption);this.initializeOption=Va(ks,a.initializeOption);this.iterations=a.iterations;this.aggressiveOption=Va(ks,a.aggressiveOption);this.packOption=a.packOption;this.setsPortSpots=a.setsPortSpots;
this.linkSpacing=a.linkSpacing;this.ra=a.ra;this.ji=a.ji;this.Ea=a.Ea;this.Vg=a.Vg;this.tc=a.tc;this.Ab=a.Ab;this.bh=a.bh;this.Fc=a.Fc;this.Sc=new J(this.Sc.x,this.Sc.y);e&&!d&&e.edges.each(function(a){if(!a.link&&a.fromVertex&&a.toVertex&&(null===a.fromVertex.node||null===a.toVertex.node)){for(var b=a.fromVertex;null!==b&&null===b.node&&0<b.td.count;){var c=b.td.J(0);if(c.link){a.link=c.link;break}b=c.fromVertex}if(!a.link){for(c=a.toVertex;null!==c&&null===c.node&&0<c.Fd.count;){var d=c.Fd.J(0);
if(d.link){a.link=d.link;break}c=d.toVertex}if(!a.link)for(c=c.td.iterator;c.next();)if(d=c.value,d.link&&d.fromVertex===b){a.link=d.link;break}}}})};ks.prototype.gb=function(a){a.classType===ks?0===a.name.indexOf("Aggressive")?this.aggressiveOption=a:0===a.name.indexOf("Cycle")?this.cycleRemoveOption=a:0===a.name.indexOf("Init")?this.initializeOption=a:0===a.name.indexOf("Layer")?this.layeringOption=a:C("Unknown enum value: "+a):mi.prototype.gb.call(this,a)};ks.prototype.createNetwork=function(){return new ps(this)};
ks.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);this.ji=-1;this.tc=this.Vg=0;this.zo=this.yo=this.xj=null;for(a=0;a<this.ye.length;a++)this.ye[a]=null;if(0<this.network.vertexes.count){this.network.Sp();if(this.Wv())return;this.cycleRemoveOption!==qs&&this.removeCycles();for(a=this.network.vertexes.iterator;a.next();)a.value.layer=-1;this.ra=-1;this.assignLayers();for(a.reset();a.next();)this.ra=
Math.max(this.ra,a.value.layer);this.cycleRemoveOption===qs&&this.removeCycles();a=this.network;for(var b=[],c=a.edges.iterator;c.next();){var d=c.value;d.valid=!1;b.push(d)}for(c=0;c<b.length;c++){d=b[c];var e=d.fromVertex,f=d.toVertex;if(!(d.valid||(null===e.node&&null===e.data||null===f.node&&null===f.data)&&e.layer===f.layer)){var g=0,h=0,k=0,l=0;if(null!==d.link){h=d.link;if(null===h)continue;var m=e.node;g=f.node;if(null===m||null===g)continue;var n=h.fromNode;k=h.toNode;var p=h.fromPort;h=
h.toPort;if(d.rev){l=n;var r=p;n=k;p=h;k=l;h=r}var q=e.focus;l=f.focus;var u=d.rev?f.bounds:e.bounds;r=J.alloc();m!==n?u.u()&&n.isVisible()?n.actualBounds.u()?(ro(n,p,xc,r),r.x+=n.actualBounds.x-u.x,r.y+=n.actualBounds.y-u.y):(ro(n,p,xc,r),r.u()||r.assign(q)):r.assign(q):u.u()?(ro(n,p,xc,r),r.u()||r.assign(q)):r.assign(q);n=d.rev?e.bounds:f.bounds;m=J.alloc();g!==k?n.u()&&k.isVisible()?k.actualBounds.u()?(ro(k,h,xc,m),m.x+=k.actualBounds.x-n.x,m.y+=k.actualBounds.y-n.y):(ro(k,h,xc,m),m.u()||m.assign(l)):
m.assign(l):n.u()?(ro(k,h,xc,m),m.u()||m.assign(l)):m.assign(l);90===this.K||270===this.K?(g=Math.round((r.x-q.x)/this.ac),k=r.x,h=Math.round((m.x-l.x)/this.ac),l=m.x):(g=Math.round((r.y-q.y)/this.ac),k=r.y,h=Math.round((m.y-l.y)/this.ac),l=m.y);J.free(r);J.free(m);d.portFromColOffset=g;d.portFromPos=k;d.portToColOffset=h;d.portToPos=l}else d.portFromColOffset=0,d.portFromPos=0,d.portToColOffset=0,d.portToPos=0;r=e.layer;m=f.layer;n=0;u=d.link;if(null!==u){var w=u.fromPort,v=u.toPort;if(null!==w&&
null!==v){var A=u.fromNode;p=u.toNode;if(null!==A&&null!==p){var y=rs(this,!0),B=rs(this,!1),z=this.setsPortSpots?y:u.computeSpot(!0,w);q=this.setsPortSpots?B:u.computeSpot(!1,v);var E=u.isOrthogonal;z.Oc()&&z.Df(B)&&q.Oc()&&q.Df(y)?n=0:(y=u.getLinkPoint(A,w,z,!0,E,p,v,J.alloc()),B=u.getLinkDirection(A,w,y,z,!0,E,p,v),J.free(y),z.Ds()||B!==ss(this,d,!0)?this.setsPortSpots&&null!==A&&1===A.ports.count&&d.rev&&(n+=1):n+=1,z=u.getLinkPoint(p,v,q,!1,E,A,w,J.alloc()),u=u.getLinkDirection(p,v,z,q,!1,E,
A,w),J.free(z),q.Ds()||u!==ss(this,d,!1)?this.setsPortSpots&&null!==p&&1===p.ports.count&&d.rev&&(n+=2):n+=2)}}}p=n;n=1===p||3===p?!0:!1;if(p=2===p||3===p?!0:!1)q=a.createVertex(),q.node=null,q.uf=1,q.layer=r,q.near=e,a.ng(q),e=a.ek(e,q,d.link),e.valid=!1,e.rev=d.rev,e.portFromColOffset=g,e.portToColOffset=0,e.portFromPos=k,e.portToPos=0,e=q;u=1;n&&u--;if(r-m>u&&0<r){d.valid=!1;q=a.createVertex();q.node=null;q.uf=2;q.layer=r-1;a.ng(q);e=a.ek(e,q,d.link);e.valid=!0;e.rev=d.rev;e.portFromColOffset=
p?0:g;e.portToColOffset=0;e.portFromPos=p?0:k;e.portToPos=0;e=q;for(r--;r-m>u&&0<r;)q=a.createVertex(),q.node=null,q.uf=3,q.layer=r-1,a.ng(q),e=a.ek(e,q,d.link),e.valid=!0,e.rev=d.rev,e.portFromColOffset=0,e.portToColOffset=0,e.portFromPos=0,e.portToPos=0,e=q,r--;e=a.ek(q,f,d.link);e.valid=!n;n&&(q.near=f);e.rev=d.rev;e.portFromColOffset=0;e.portToColOffset=h;e.portFromPos=0;e.portToPos=l}else d.valid=!0}}a=this.Ab=[];for(b=0;b<=this.ra;b++)a[b]=0;for(b=this.network.vertexes.iterator;b.next();)b.value.index=
-1;this.initializeIndices();this.ji=-1;for(c=this.tc=this.Vg=0;c<=this.ra;c++)a[c]>a[this.tc]&&(this.ji=a[c]-1,this.tc=c),a[c]<a[this.Vg]&&(this.Vg=c);this.zo=[];for(c=0;c<a.length;c++)this.zo[c]=[];for(b.reset();b.next();)a=b.value,this.zo[a.layer][a.index]=a;this.Ea=-1;for(a=0;a<=this.ra;a++){b=ts(this,a);c=0;d=this.Ab[a];for(f=0;f<d;f++)e=b[f],c+=this.nodeMinColumnSpace(e,!0),e.column=c,c+=1,c+=this.nodeMinColumnSpace(e,!1);this.Ea=Math.max(this.Ea,c-1);us(this,a,b)}this.reduceCrossings();this.straightenAndPack();
this.updateParts()}this.network=null;this.isValidLayout=!0};ks.prototype.linkMinLength=function(){return 1};function vs(a){var b=a.fromVertex.node||a.fromVertex.data;a=a.toVertex.node||a.toVertex.data;return null===b&&null===a?8:null===b||null===a?4:1}ks.prototype.nodeMinLayerSpace=function(a,b){return null===a.node&&null===a.data?0:90===this.K||270===this.K?b?a.focus.y+10:a.bounds.height-a.focus.y+10:b?a.focus.x+10:a.bounds.width-a.focus.x+10};
ks.prototype.nodeMinColumnSpace=function(a,b){if(null===a.node&&null===a.data)return 0;var c=b?a.ik:a.hk;if(null!==c)return c;c=this.K;return 90===c||270===c?b?a.ik=a.focus.x/this.ac+1|0:a.hk=(a.bounds.width-a.focus.x)/this.ac+1|0:b?a.ik=a.focus.y/this.ac+1|0:a.hk=(a.bounds.height-a.focus.y)/this.ac+1|0};function ws(a){null===a.xj&&(a.xj=[]);for(var b=0,c=a.network.vertexes.iterator;c.next();){var d=c.value;a.xj[b]=d.layer;b++;a.xj[b]=d.column;b++;a.xj[b]=d.index;b++}return a.xj}
function xs(a,b){var c=0;for(a=a.network.vertexes.iterator;a.next();){var d=a.value;d.layer=b[c];c++;d.column=b[c];c++;d.index=b[c];c++}}
function ys(a,b,c){var d=ts(a,b),e=a.Ab[b];if(null===a.yo||a.yo.length<e*e)a.yo=[];for(var f=a.yo,g=0;g<e;g++){var h=0,k=d[g],l=k.near;if(null!==l&&l.layer===k.layer)if(k=l.index,k>g)for(var m=g+1;m<k;m++){var n=d[m];n.near===l&&n.uf===l.uf||h++}else for(m=g-1;m>k;m--)n=d[m],n.near===l&&n.uf===l.uf||h++;var p;if(0<=c)for(k=d[g].sourceEdgesArrayAccess,l=0;l<k.length;l++){var r=k[l];if(r.valid&&r.fromVertex.layer!==b)for(n=r.fromVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++){var q=
k[p];if(q.valid&&q.fromVertex.layer!==b){var u=q.fromVertex.index;var w=q.portToPos;q=q.portFromPos;m<w&&(n>u||n===u&&r>q)&&h++;w<m&&(u>n||u===n&&q>r)&&h++}}}if(0>=c)for(k=d[g].destinationEdgesArrayAccess,l=0;l<k.length;l++)if(r=k[l],r.valid&&r.toVertex.layer!==b)for(n=r.toVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++)q=k[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,w=q.portToPos,q=q.portFromPos,r<q&&(n>u||n===u&&m>w)&&h++,q<r&&(u>n||u===n&&w>m)&&h++);f[g*e+g]=h;for(k=g+
1;k<e;k++){var v=0,A=0;if(0<=c){h=d[g].sourceEdgesArrayAccess;var y=d[k].sourceEdgesArrayAccess;for(l=0;l<h.length;l++)if(r=h[l],r.valid&&r.fromVertex.layer!==b)for(n=r.fromVertex.index,r=r.portFromPos,p=0;p<y.length;p++)q=y[p],q.valid&&q.fromVertex.layer!==b&&(u=q.fromVertex.index,q=q.portFromPos,(n<u||n===u&&r<q)&&A++,(u<n||u===n&&q<r)&&v++)}if(0>=c)for(h=d[g].destinationEdgesArrayAccess,y=d[k].destinationEdgesArrayAccess,l=0;l<h.length;l++)if(r=h[l],r.valid&&r.toVertex.layer!==b)for(n=r.toVertex.index,
m=r.portToPos,p=0;p<y.length;p++)q=y[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,w=q.portToPos,(n<u||n===u&&m<w)&&A++,(u<n||u===n&&w<m)&&v++);f[g*e+k]=v;f[k*e+g]=A}}us(a,b,d);return f}ks.prototype.countCrossings=function(){for(var a=0,b=0;b<=this.ra;b++)for(var c=ys(this,b,1),d=this.Ab[b],e=0;e<d;e++)for(var f=e;f<d;f++)a+=c[e*d+f];return a};
function zs(a){for(var b=0,c=0;c<=a.ra;c++){for(var d=a,e=c,f=ts(d,e),g=d.Ab[e],h=0,k=0;k<g;k++){var l=f[k].destinationEdgesArrayAccess;if(null!==l)for(var m=0;m<l.length;m++){var n=l[m];if(n.valid&&n.toVertex.layer!==e){var p=n.fromVertex.column+n.portFromColOffset;var r=n.toVertex.column+n.portToColOffset;h+=(Math.abs(p-r)+1)*vs(n)}}}us(d,e,f);b+=h}return b}
ks.prototype.normalize=function(){var a=Infinity;this.Ea=-1;for(var b=this.network.vertexes.iterator;b.next();){var c=b.value;a=Math.min(a,c.column-this.nodeMinColumnSpace(c,!0));this.Ea=Math.max(this.Ea,c.column+this.nodeMinColumnSpace(c,!1))}for(b.reset();b.next();)b.value.column-=a;this.Ea-=a};
function As(a,b,c){for(var d=ts(a,b),e=a.Ab[b],f=[],g=0;g<e;g++){var h=d[g],k=null;0>=c&&(k=h.sourceEdgesArrayAccess);var l=null;0<=c&&(l=h.destinationEdgesArrayAccess);var m=0,n=0,p=h.near;null!==p&&p.layer===h.layer&&(m+=p.column-1,n++);if(null!==k)for(p=0;p<k.length;p++){h=k[p];var r=h.fromVertex;h.valid&&!h.rev&&r.layer!==b&&(m+=r.column,n++)}if(null!==l)for(k=0;k<l.length;k++)h=l[k],p=h.toVertex,h.valid&&!h.rev&&p.layer!==b&&(m+=p.column,n++);f[g]=0===n?-1:m/n}us(a,b,d);return f}
function Bs(a,b,c){for(var d=ts(a,b),e=a.Ab[b],f=[],g=0;g<e;g++){var h=d[g],k=null;0>=c&&(k=h.sourceEdgesArrayAccess);var l=null;0<=c&&(l=h.destinationEdgesArrayAccess);var m=0,n=[],p=h.near;null!==p&&p.layer===h.layer&&(n[m]=p.column-1,m++);h=void 0;if(null!==k)for(p=0;p<k.length;p++){h=k[p];var r=h.fromVertex;h.valid&&!h.rev&&r.layer!==b&&(n[m]=r.column+h.portFromColOffset,m++)}if(null!==l)for(k=0;k<l.length;k++)h=l[k],p=h.toVertex,h.valid&&!h.rev&&p.layer!==b&&(n[m]=p.column+h.portToColOffset,
m++);0===m?f[g]=-1:(n.sort(function(a,b){return a-b}),l=m>>1,f[g]=0!==(m&1)?n[l]:n[l-1]+n[l]>>1)}us(a,b,d);return f}function Cs(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();){var h=g.value;var k=h.toVertex;var l=b.layer-k.layer;h=a.linkMinLength(h);l===h&&Cs(a,k,c,d,e,f)}if(f)for(g=b.sourceEdges;g.next();)h=g.value,k=h.fromVertex,l=k.layer-b.layer,h=a.linkMinLength(h),l===h&&Cs(a,k,c,d,e,f)}}
function Ds(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();)Ds(a,g.value.toVertex,c,d,e,f);if(f)for(b=b.sourceEdges;b.next();)Ds(a,b.value.fromVertex,c,d,e,f)}}
ks.prototype.removeCycles=function(){for(var a=this.network.edges.iterator;a.next();)a.value.rev=!1;switch(this.Kk){default:case Es:a=this.network;var b=0,c=a.vertexes.count-1,d=[];d.length=c+1;for(var e=a.vertexes.iterator;e.next();)e.value.valid=!0;for(;null!==Fs(a);){for(e=Gs(a);null!==e;)d[c]=e,c--,e.valid=!1,e=Gs(a);for(e=Hs(a);null!==e;)d[b]=e,b++,e.valid=!1,e=Hs(a);e=null;for(var f=0,g=this.network.vertexes.iterator;g.next();){var h=g.value;if(h.valid){for(var k=0,l=h.destinationEdges;l.next();)l.value.toVertex.valid&&
k++;l=0;for(var m=h.sourceEdges;m.next();)m.value.fromVertex.valid&&l++;if(null===e||f<k-l)e=h,f=k-l}}null!==e&&(d[b]=e,b++,e.valid=!1)}for(b=0;b<a.vertexes.count;b++)d[b].index=b;for(d=a.edges.iterator;d.next();)b=d.value,b.fromVertex.index>b.toVertex.index&&(a.qm(b),b.rev=!0);break;case ls:for(d=this.network.vertexes.iterator;d.next();)a=d.value,a.og=-1,a.finish=-1;for(a=this.network.edges.iterator;a.next();)a.value.forest=!1;this.bh=0;for(d.reset();d.next();)b=d.value,0===b.sourceEdges.count&&
Is(this,b);for(d.reset();d.next();)b=d.value,-1===b.og&&Is(this,b);for(a.reset();a.next();)d=a.value,d.forest||(b=d.fromVertex,c=b.finish,e=d.toVertex,f=e.finish,e.og<b.og&&c<f&&(this.network.qm(d),d.rev=!0));break;case qs:a=this.network;b=a.vertexes.iterator;for(d=Infinity;b.next();)d=Math.min(d,b.value.layer);if(Infinity>d){if(0>d)for(b.reset();b.next();)b.value.layer-=d;d=[];for(b.reset();b.next();)c=b.value,e=d[c.layer],void 0===e?d[c.layer]=[c]:e.push(c);for(c=b=0;c<d.length;c++)if(e=d[c],!e||
0===e.length)b++;else if(0<c)for(f=0;f<e.length;f++)e[f].layer-=b;for(d=a.edges.iterator;d.next();)b=d.value,b.fromVertex.layer<b.toVertex.layer&&(a.qm(b),b.rev=!0)}}};function Fs(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid)return b}return null}function Gs(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid){for(var c=!0,d=b.destinationEdges;d.next();)if(d.value.toVertex.valid){c=!1;break}if(c)return b}}return null}
function Hs(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid){for(var c=!0,d=b.sourceEdges;d.next();)if(d.value.fromVertex.valid){c=!1;break}if(c)return b}}return null}function Is(a,b){b.og=a.bh;a.bh++;for(var c=b.destinationEdges;c.next();){var d=c.value,e=d.toVertex;-1===e.og&&(d.forest=!0,Is(a,e))}b.finish=a.bh;a.bh++}
ks.prototype.assignLayers=function(){switch(this.il){case Js:Ks(this);break;case Ls:for(var a,b=this.network.vertexes.iterator;b.next();)a=Ms(this,b.value),this.ra=Math.max(a,this.ra);for(b.reset();b.next();)a=b.value,a.layer=this.ra-a.layer;break;default:case ms:Ks(this);for(b=this.network.vertexes.iterator;b.next();)b.value.valid=!1;for(b.reset();b.next();)a=b.value,0===a.sourceEdges.count&&Ns(this,a);a=Infinity;for(b.reset();b.next();)a=Math.min(a,b.value.layer);this.ra=-1;for(b.reset();b.next();){var c=
b.value;c.layer-=a;this.ra=Math.max(this.ra,c.layer)}}};function Ks(a){for(var b=a.network.vertexes.iterator;b.next();){var c=Os(a,b.value);a.ra=Math.max(c,a.ra)}}function Os(a,b){var c=0;if(-1===b.layer){for(var d=b.destinationEdges;d.next();){var e=d.value,f=e.toVertex;e=a.linkMinLength(e);c=Math.max(c,Os(a,f)+e)}b.layer=c}else c=b.layer;return c}
function Ms(a,b){var c=0;if(-1===b.layer){for(var d=b.sourceEdges;d.next();){var e=d.value,f=e.fromVertex;e=a.linkMinLength(e);c=Math.max(c,Ms(a,f)+e)}b.layer=c}else c=b.layer;return c}
function Ns(a,b){if(!b.valid){b.valid=!0;for(var c=b.destinationEdges;c.next();)Ns(a,c.value.toVertex);for(c=a.network.vertexes.iterator;c.next();)c.value.component=-1;for(var d=b.sourceEdgesArrayAccess,e=d.length,f=0;f<e;f++){var g=d[f],h=g.fromVertex,k=g.toVertex;g=a.linkMinLength(g);h.layer-k.layer>g&&Cs(a,h,0,-1,!0,!1)}for(Cs(a,b,1,-1,!0,!0);0!==b.component;){f=0;d=Infinity;h=0;k=null;for(g=a.network.vertexes.iterator;g.next();){var l=g.value;if(1===l.component){var m=0,n=!1,p=l.sourceEdgesArrayAccess;
e=p.length;for(var r=0;r<e;r++){var q=p[r],u=q.fromVertex;m+=1;1!==u.component&&(f+=1,u=u.layer-l.layer,q=a.linkMinLength(q),d=Math.min(d,u-q))}p=l.destinationEdgesArrayAccess;e=p.length;for(r=0;r<e;r++)q=p[r].toVertex,--m,1!==q.component?--f:n=!0;(null===k||m<h)&&!n&&(k=l,h=m)}}if(0<f){for(c.reset();c.next();)e=c.value,1===e.component&&(e.layer+=d);b.component=0}else k.component=0}for(c=a.network.vertexes.iterator;c.next();)c.value.component=-1;for(Cs(a,b,1,-1,!0,!1);0!==b.component;){d=0;e=Infinity;
f=0;h=null;for(k=a.network.vertexes.iterator;k.next();)if(g=k.value,1===g.component){l=0;m=!1;p=g.sourceEdgesArrayAccess;n=p.length;for(r=0;r<n;r++)q=p[r].fromVertex,l+=1,1!==q.component?d+=1:m=!0;p=g.destinationEdgesArrayAccess;n=p.length;for(r=0;r<n;r++)q=p[r],u=q.toVertex,--l,1!==u.component&&(--d,u=g.layer-u.layer,q=a.linkMinLength(q),e=Math.min(e,u-q));(null===h||l>f)&&!m&&(h=g,f=l)}if(0>d){for(c.reset();c.next();)d=c.value,1===d.component&&(d.layer-=e);b.component=0}else h.component=0}}}
function ss(a,b,c){return 90===a.K?c&&!b.rev||!c&&b.rev?270:90:180===a.K?c&&!b.rev||!c&&b.rev?0:180:270===a.K?c&&!b.rev||!c&&b.rev?90:270:c&&!b.rev||!c&&b.rev?180:0}
ks.prototype.initializeIndices=function(){switch(this.Zk){default:case Ps:for(var a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;b.index=this.Ab[c];this.Ab[c]++}break;case ns:a=this.network.vertexes.iterator;for(b=this.ra;0<=b;b--)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&Qs(this,c);break;case Rs:for(a=this.network.vertexes.iterator,b=0;b<=this.ra;b++)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&Ss(this,c)}};
function Qs(a,b){var c=b.layer;b.index=a.Ab[c];a.Ab[c]++;b=b.destinationEdgesArrayAccess;for(c=!0;c;){c=!1;for(var d=0;d<b.length-1;d++){var e=b[d],f=b[d+1];e.portFromColOffset>f.portFromColOffset&&(c=!0,b[d]=f,b[d+1]=e)}}for(c=0;c<b.length;c++)d=b[c],d.valid&&(d=d.toVertex,-1===d.index&&Qs(a,d))}
function Ss(a,b){var c=b.layer;b.index=a.Ab[c];a.Ab[c]++;b=b.sourceEdgesArrayAccess;for(var d=!0;d;)for(d=!1,c=0;c<b.length-1;c++){var e=b[c],f=b[c+1];e.portToColOffset>f.portToColOffset&&(d=!0,b[c]=f,b[c+1]=e)}for(c=0;c<b.length;c++)d=b[c],d.valid&&(d=d.fromVertex,-1===d.index&&Ss(a,d))}
ks.prototype.reduceCrossings=function(){var a=this.countCrossings(),b=ws(this),c,d;for(c=0;c<this.qj;c++){for(d=0;d<=this.ra;d++)Ts(this,d,1),Us(this,d,1);var e=this.countCrossings();e<a&&(a=e,b=ws(this));for(d=this.ra;0<=d;d--)Ts(this,d,-1),Us(this,d,-1);e=this.countCrossings();e<a&&(a=e,b=ws(this))}xs(this,b);for(c=0;c<this.qj;c++){for(d=0;d<=this.ra;d++)Ts(this,d,0),Us(this,d,0);e=this.countCrossings();e<a&&(a=e,b=ws(this));for(d=this.ra;0<=d;d--)Ts(this,d,0),Us(this,d,0);e=this.countCrossings();
e<a&&(a=e,b=ws(this))}xs(this,b);var f,g,h;switch(this.vk){case Vs:break;case Ws:for(h=a+1;(d=this.countCrossings())<h;)for(h=d,c=this.ra;0<=c;c--)for(g=0;g<=c;g++){for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Us(this,d,-1)||f;e=this.countCrossings();e>=a?xs(this,b):(a=e,b=ws(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Us(this,d,1)||f;e=this.countCrossings();e>=a?xs(this,b):(a=e,b=ws(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Us(this,d,1)||f;e>=a?xs(this,b):(a=e,b=ws(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=
Us(this,d,-1)||f;e>=a?xs(this,b):(a=e,b=ws(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Us(this,d,0)||f;e>=a?xs(this,b):(a=e,b=ws(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Us(this,d,0)||f;e>=a?xs(this,b):(a=e,b=ws(this))}break;default:case os:for(c=this.ra,g=0,h=a+1;(d=this.countCrossings())<h;){h=d;for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Us(this,d,-1)||f;e=this.countCrossings();e>=a?xs(this,b):(a=e,b=ws(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Us(this,d,1)||f;e=this.countCrossings();e>=a?xs(this,b):
(a=e,b=ws(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Us(this,d,1)||f;e>=a?xs(this,b):(a=e,b=ws(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Us(this,d,-1)||f;e>=a?xs(this,b):(a=e,b=ws(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Us(this,d,0)||f;e>=a?xs(this,b):(a=e,b=ws(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Us(this,d,0)||f;e>=a?xs(this,b):(a=e,b=ws(this))}}xs(this,b)};
function Ts(a,b,c){var d=ts(a,b),e=a.Ab[b],f=Bs(a,b,c),g=As(a,b,c);for(c=0;c<e;c++)-1===g[c]&&(g[c]=d[c].column),-1===f[c]&&(f[c]=d[c].column);for(var h=!0,k;h;)for(h=!1,c=0;c<e-1;c++)if(f[c+1]<f[c]||f[c+1]===f[c]&&g[c+1]<g[c])h=!0,k=f[c],f[c]=f[c+1],f[c+1]=k,k=g[c],g[c]=g[c+1],g[c+1]=k,k=d[c],d[c]=d[c+1],d[c+1]=k;for(c=f=0;c<e;c++)k=d[c],k.index=c,f+=a.nodeMinColumnSpace(k,!0),k.column=f,f+=1,f+=a.nodeMinColumnSpace(k,!1);us(a,b,d)}
function Us(a,b,c){var d=ts(a,b),e=a.Ab[b];c=ys(a,b,c);var f;var g=[];for(f=0;f<e;f++)g[f]=-1;var h=[];for(f=0;f<e;f++)h[f]=-1;for(var k=!1,l=!0;l;)for(l=!1,f=0;f<e-1;f++){var m=c[d[f].index*e+d[f+1].index],n=c[d[f+1].index*e+d[f].index],p=0,r=0,q=d[f].column,u=d[f+1].column,w=a.nodeMinColumnSpace(d[f],!0),v=a.nodeMinColumnSpace(d[f],!1),A=a.nodeMinColumnSpace(d[f+1],!0),y=a.nodeMinColumnSpace(d[f+1],!1);w=q-w+A;v=u-v+y;var B=d[f].sourceEdges.iterator;for(B.reset();B.next();)if(A=B.value,y=A.fromVertex,
A.valid&&y.layer===b){for(A=0;d[A]!==y;)A++;A<f&&(p+=2*(f-A),r+=2*(f+1-A));A===f+1&&(p+=1);A>f+1&&(p+=4*(A-f),r+=4*(A-(f+1)))}B=d[f].destinationEdges.iterator;for(B.reset();B.next();)if(A=B.value,y=A.toVertex,A.valid&&y.layer===b){for(A=0;d[A]!==y;)A++;A===f+1&&(r+=1)}B=d[f+1].sourceEdges.iterator;for(B.reset();B.next();)if(A=B.value,y=A.fromVertex,A.valid&&y.layer===b){for(A=0;d[A]!==y;)A++;A<f&&(p+=2*(f+1-A),r+=2*(f-A));A===f&&(r+=1);A>f+1&&(p+=4*(A-(f+1)),r+=4*(A-f))}B=d[f+1].destinationEdges.iterator;
for(B.reset();B.next();)if(A=B.value,y=A.toVertex,A.valid&&y.layer===b){for(A=0;d[A]!==y;)A++;A===f&&(p+=1)}A=y=0;B=g[d[f].index];var z=h[d[f].index],E=g[d[f+1].index],K=h[d[f+1].index];-1!==B&&(y+=Math.abs(B-q),A+=Math.abs(B-v));-1!==z&&(y+=Math.abs(z-q),A+=Math.abs(z-v));-1!==E&&(y+=Math.abs(E-u),A+=Math.abs(E-w));-1!==K&&(y+=Math.abs(K-u),A+=Math.abs(K-w));if(r<p-.5||r===p&&n<m-.5||r===p&&n===m&&A<y-.5)l=k=!0,d[f].column=v,d[f+1].column=w,m=d[f],d[f]=d[f+1],d[f+1]=m}for(f=0;f<e;f++)d[f].index=
f;us(a,b,d);return k}
ks.prototype.straightenAndPack=function(){var a=0!==(this.ag&1);var b=0!==(this.ag&Xs);1E3<this.network.edges.count&&b&&(a=!1);if(a){var c=[];for(b=0;b<=this.ra;b++)c[b]=0;for(var d,e=this.network.vertexes.iterator;e.next();){var f=e.value;b=f.layer;d=f.column;f=this.nodeMinColumnSpace(f,!1);c[b]=Math.max(c[b],d+f)}for(e.reset();e.next();)f=e.value,b=f.layer,d=f.column,f.column=(8*(this.Ea-c[b])>>1)+8*d;this.Ea*=8}if(0!==(this.ag&2))for(c=!0;c;){c=!1;for(b=this.tc+1;b<=this.ra;b++)c=Ys(this,b,1)||
c;for(b=this.tc-1;0<=b;b--)c=Ys(this,b,-1)||c;c=Ys(this,this.tc,0)||c}if(0!==(this.ag&4)){for(b=this.tc+1;b<=this.ra;b++)Zs(this,b,1);for(b=this.tc-1;0<=b;b--)Zs(this,b,-1);Zs(this,this.tc,0)}a&&($s(this,-1),$s(this,1));if(0!==(this.ag&2))for(c=!0;c;){c=!1;c=Ys(this,this.tc,0)||c;for(b=this.tc+1;b<=this.ra;b++)c=Ys(this,b,0)||c;for(b=this.tc-1;0<=b;b--)c=Ys(this,b,0)||c}};function Ys(a,b,c){for(var d=!1;at(a,b,c);)d=!0;return d}
function at(a,b,c){var d,e=ts(a,b),f=a.Ab[b],g=As(a,b,-1);if(0<c)for(d=0;d<f;d++)g[d]=-1;var h=As(a,b,1);if(0>c)for(d=0;d<f;d++)h[d]=-1;for(var k=!1,l=!0;l;)for(l=!1,d=0;d<f;d++){var m=e[d].column,n=a.nodeMinColumnSpace(e[d],!0),p=a.nodeMinColumnSpace(e[d],!1),r=0;0>d-1||m-e[d-1].column-1>n+a.nodeMinColumnSpace(e[d-1],!1)?r=m-1:r=m;n=d+1>=f||e[d+1].column-m-1>p+a.nodeMinColumnSpace(e[d+1],!0)?m+1:m;var q=p=0,u=0;if(0>=c)for(var w=e[d].sourceEdges.iterator;w.next();){var v=w.value;var A=v.fromVertex;
if(v.valid&&A.layer!==b){var y=vs(v);var B=v.portFromColOffset;v=v.portToColOffset;A=A.column;p+=(Math.abs(m+v-(A+B))+1)*y;q+=(Math.abs(r+v-(A+B))+1)*y;u+=(Math.abs(n+v-(A+B))+1)*y}}if(0<=c)for(w=e[d].destinationEdges.iterator;w.next();)v=w.value,A=v.toVertex,v.valid&&A.layer!==b&&(y=vs(v),B=v.portFromColOffset,v=v.portToColOffset,A=A.column,p+=(Math.abs(m+B-(A+v))+1)*y,q+=(Math.abs(r+B-(A+v))+1)*y,u+=(Math.abs(n+B-(A+v))+1)*y);v=B=y=0;w=g[e[d].index];A=h[e[d].index];-1!==w&&(y+=Math.abs(w-m),B+=
Math.abs(w-r),v+=Math.abs(w-n));-1!==A&&(y+=Math.abs(A-m),B+=Math.abs(A-r),v+=Math.abs(A-n));if(q<p||q===p&&B<y)l=k=!0,e[d].column=r;else if(u<p||u===p&&v<y)l=k=!0,e[d].column=n}us(a,b,e);a.normalize();return k}
function Zs(a,b,c){var d=ts(a,b),e=a.Ab[b],f=Bs(a,b,c),g=[];for(c=0;c<e;c++)g[c]=f[c];for(f=!0;f;)for(f=!1,c=0;c<e;c++){var h=d[c].column,k=a.nodeMinColumnSpace(d[c],!0),l=a.nodeMinColumnSpace(d[c],!1),m=0;if(-1===g[c])if(0===c&&c===e-1)m=h;else if(0===c){var n=d[c+1].column;n-h===l+a.nodeMinColumnSpace(d[c+1],!0)?m=h-1:m=h}else c===e-1?(n=d[c-1].column,m=h-n===k+a.nodeMinColumnSpace(d[c-1],!1)?h+1:h):(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+
1],!0)-l-1,m=(k+l)/2|0);else 0===c&&c===e-1?m=g[c]:0===c?(n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+1],!0)-l-1,m=Math.min(g[c],l)):c===e-1?(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,m=Math.max(g[c],k)):(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+1],!0)-l-1,k<g[c]&&g[c]<l?m=g[c]:k>=g[c]?m=k:l<=g[c]&&(m=l));m!==h&&(f=!0,d[c].column=m)}us(a,b,d);a.normalize()}
function bt(a,b){for(var c=!0,d=a.network.vertexes.iterator;d.next();){var e=d.value,f=a.nodeMinColumnSpace(e,!0),g=a.nodeMinColumnSpace(e,!1);if(e.column-f<=b&&e.column+g>=b){c=!1;break}}a=!1;if(c)for(d.reset();d.next();)c=d.value,c.column>b&&(--c.column,a=!0);return a}
function ct(a,b){var c=b+1;var d,e=[],f=[];for(d=0;d<=a.ra;d++)e[d]=!1,f[d]=!1;for(var g=a.network.vertexes.iterator;g.next();){d=g.value;var h=d.column-a.nodeMinColumnSpace(d,!0),k=d.column+a.nodeMinColumnSpace(d,!1);h<=b&&k>=b&&(e[d.layer]=!0);h<=c&&k>=c&&(f[d.layer]=!0)}h=!0;c=!1;for(d=0;d<=a.ra;d++)h=h&&!(e[d]&&f[d]);if(h)for(g.reset();g.next();)a=g.value,a.column>b&&(--a.column,c=!0);return c}
function $s(a,b){for(var c=0;c<=a.Ea;c++)for(;bt(a,c););a.normalize();for(c=0;c<a.Ea;c++)for(;ct(a,c););a.normalize();var d;if(0<b)for(c=0;c<=a.Ea;c++){var e=ws(a);var f=zs(a);for(d=f+1;f<d;){d=f;dt(a,c,1);var g=zs(a);g>f?xs(a,e):g<f&&(f=g,e=ws(a))}}if(0>b)for(c=a.Ea;0<=c;c--)for(e=ws(a),f=zs(a),d=f+1;f<d;)d=f,dt(a,c,-1),g=zs(a),g>f?xs(a,e):g<f&&(f=g,e=ws(a));a.normalize()}
function dt(a,b,c){a.Fc=0;for(var d=a.network.vertexes.iterator;d.next();)d.value.component=-1;if(0<c)for(d.reset();d.next();){var e=d.value;e.column-a.nodeMinColumnSpace(e,!0)<=b&&(e.component=a.Fc)}if(0>c)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.Fc);a.Fc++;for(d.reset();d.next();)b=d.value,-1===b.component&&(Ds(a,b,a.Fc,-1,!0,!0),a.Fc++);var f;b=[];for(f=0;f<a.Fc*a.Fc;f++)b[f]=!1;e=[];for(f=0;f<(a.ra+1)*(a.Ea+1);f++)e[f]=-1;for(d.reset();d.next();){f=
d.value;for(var g=f.layer,h=Math.max(0,f.column-a.nodeMinColumnSpace(f,!0)),k=Math.min(a.Ea,f.column+a.nodeMinColumnSpace(f,!1));h<=k;h++)e[g*(a.Ea+1)+h]=f.component}for(f=0;f<=a.ra;f++){if(0<c)for(g=0;g<a.Ea;g++)-1!==e[f*(a.Ea+1)+g]&&-1!==e[f*(a.Ea+1)+g+1]&&e[f*(a.Ea+1)+g]!==e[f*(a.Ea+1)+g+1]&&(b[e[f*(a.Ea+1)+g]*a.Fc+e[f*(a.Ea+1)+g+1]]=!0);if(0>c)for(g=a.Ea;0<g;g--)-1!==e[f*(a.Ea+1)+g]&&-1!==e[f*(a.Ea+1)+g-1]&&e[f*(a.Ea+1)+g]!==e[f*(a.Ea+1)+g-1]&&(b[e[f*(a.Ea+1)+g]*a.Fc+e[f*(a.Ea+1)+g-1]]=!0)}e=
[];for(f=0;f<a.Fc;f++)e[f]=!0;g=[];for(g.push(0);0!==g.length;)if(k=g[g.length-1],g.pop(),e[k])for(e[k]=!1,f=0;f<a.Fc;f++)b[k*a.Fc+f]&&g.splice(0,0,f);if(0<c)for(d.reset();d.next();)a=d.value,e[a.component]&&--a.column;if(0>c)for(d.reset();d.next();)c=d.value,e[c.component]&&(c.column+=1)}
ks.prototype.commitLayout=function(){if(this.setsPortSpots)for(var a=rs(this,!0),b=rs(this,!1),c=this.network.edges.iterator;c.next();){var d=c.value.link;null!==d&&(d.fromSpot=a,d.toSpot=b)}this.commitNodes();this.Bu();this.isRouting&&this.commitLinks()};function rs(a,b){return 270===a.K?b?$c:cd:90===a.K?b?cd:$c:180===a.K?b?ad:bd:b?bd:ad}
ks.prototype.commitNodes=function(){this.ae=[];this.yd=[];this.xd=[];this.Ka=[];for(var a=0;a<=this.ra;a++)this.ae[a]=0,this.yd[a]=0,this.xd[a]=0,this.Ka[a]=0;for(a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;this.ae[c]=Math.max(this.ae[c],this.nodeMinLayerSpace(b,!0));this.yd[c]=Math.max(this.yd[c],this.nodeMinLayerSpace(b,!1))}b=0;c=this.be;for(var d=0;d<=this.ra;d++){var e=c;0>=this.ae[d]+this.yd[d]&&(e=0);0<d&&(b+=e/2);90===this.K||0===this.K?(b+=this.yd[d],this.xd[d]=b,
b+=this.ae[d]):(b+=this.ae[d],this.xd[d]=b,b+=this.yd[d]);d<this.ra&&(b+=e/2);this.Ka[d]=b}c=b;b=this.arrangementOrigin;for(d=0;d<=this.ra;d++)270===this.K?this.xd[d]=b.y+this.xd[d]:90===this.K?(this.xd[d]=b.y+c-this.xd[d],this.Ka[d]=c-this.Ka[d]):180===this.K?this.xd[d]=b.x+this.xd[d]:(this.xd[d]=b.x+c-this.xd[d],this.Ka[d]=c-this.Ka[d]);a.reset();for(c=d=Infinity;a.next();){e=a.value;var f=e.layer,g=e.column|0;if(270===this.K||90===this.K){var h=b.x+this.ac*g;f=this.xd[f]}else h=this.xd[f],f=b.y+
this.ac*g;e.centerX=h;e.centerY=f;d=Math.min(e.x,d);c=Math.min(e.y,c)}d=b.x-d;b=b.y-c;this.Sc=new J(d,b);for(a.reset();a.next();)c=a.value,c.x+=d,c.y+=b,c.commit()};
ks.prototype.Bu=function(){for(var a=0,b=this.be,c=0;c<=this.ra;c++)a+=this.ae[c],a+=this.yd[c];a+=this.ra*b;b=[];c=this.ac*this.Ea;for(var d=this.maxLayer;0<=d;d--)270===this.K?0===d?b.push(new M(0,0,c,Math.abs(this.Ka[0]))):b.push(new M(0,this.Ka[d-1],c,Math.abs(this.Ka[d-1]-this.Ka[d]))):90===this.K?0===d?b.push(new M(0,this.Ka[0],c,Math.abs(this.Ka[0]-a))):b.push(new M(0,this.Ka[d],c,Math.abs(this.Ka[d-1]-this.Ka[d]))):180===this.K?0===d?b.push(new M(0,0,Math.abs(this.Ka[0]),c)):b.push(new M(this.Ka[d-
1],0,Math.abs(this.Ka[d-1]-this.Ka[d]),c)):0===d?b.push(new M(this.Ka[0],0,Math.abs(this.Ka[0]-a),c)):b.push(new M(this.Ka[d],0,Math.abs(this.Ka[d-1]-this.Ka[d]),c));this.commitLayers(b,this.Sc)};ks.prototype.commitLayers=function(){};
ks.prototype.commitLinks=function(){for(var a=this.network.edges.iterator,b;a.next();)b=a.value.link,null!==b&&(b.Lh(),b.Pj(),b.vf());for(a.reset();a.next();)b=a.value.link,null!==b&&b.ug();for(a.reset();a.next();){var c=a.value;b=c.link;if(null!==b){b.Lh();var d=b,e=d.fromNode,f=d.toNode,g=d.fromPort,h=d.toPort;if(null!==e){var k=e.findVisibleNode();null!==k&&k!==e&&(e=k,g=k.port)}null!==f&&(k=f.findVisibleNode(),null!==k&&k!==f&&(f=k,h=k.port));var l=b.computeSpot(!0,g);k=b.computeSpot(!1,h);var m=
c.fromVertex,n=c.toVertex;if(c.valid){if(b.curve===Uf&&4===b.pointsCount)if(m.column===n.column)c=b.getLinkPoint(e,g,l,!0,!1,f,h),g=b.getLinkPoint(f,h,k,!1,!1,e,g),c.u()||c.set(e.actualBounds.center),g.u()||g.set(f.actualBounds.center),b.Pj(),b.tf(c.x,c.y),b.tf((2*c.x+g.x)/3,(2*c.y+g.y)/3),b.tf((c.x+2*g.x)/3,(c.y+2*g.y)/3),b.tf(g.x,g.y);else{var p=!1,r=!1;null!==g&&l===qc&&(p=!0);null!==h&&k===qc&&(r=!0);if(p||r){var q=b.i(0).x;c=b.i(0).y;m=b.i(3).x;d=b.i(3).y;if(p){if(90===this.K||270===this.K){p=
q;var u=(c+d)/2}else p=(q+m)/2,u=c;b.M(1,p,u);l=b.getLinkPoint(e,g,l,!0,!1,f,h);l.u()||l.set(e.actualBounds.center);b.M(0,l.x,l.y)}r&&(90===this.K||270===this.K?(l=m,c=(c+d)/2):(l=(q+m)/2,c=d),b.M(2,l,c),e=b.getLinkPoint(f,h,k,!1,!1,e,g),e.u()||e.set(f.actualBounds.center),b.M(3,e.x,e.y))}}b.vf()}else if(m.layer===n.layer)b.vf();else{p=r=!1;u=this.be;q=b.firstPickIndex+1;if(b.isOrthogonal){p=!0;var w=b.pointsCount;4<w&&b.points.removeRange(2,w-3)}else if(b.curve===Uf)r=!0,w=b.pointsCount,4<w&&b.points.removeRange(2,
w-3),4===w&&(q=2);else{w=b.pointsCount;var v=l===qc,A=k===qc;2<w&&v&&A?b.points.removeRange(1,w-2):3<w&&v&&!A?b.points.removeRange(1,w-3):3<w&&!v&&A?b.points.removeRange(2,w-2):4<w&&!v&&!A&&b.points.removeRange(2,w-3)}if(c.rev){for(;null!==n&&m!==n;){var y=w=null;for(v=n.sourceEdges.iterator;v.next()&&(A=v.value,A.link!==c.link||(w=A.fromVertex,y=A.toVertex,null!==w.node)););if(null===w)break;if(w!==m){v=b.i(q-1).x;A=b.i(q-1).y;var B=w.centerX;var z=w.centerY;if(p)180===this.K||0===this.K?q===b.firstPickIndex+
1?(b.l(q++,v,A),b.l(q++,v,z)):(null!==y?y.centerY:A)!==z&&(y=this.Ka[w.layer-1]+this.Sc.x,b.l(q++,y,A),b.l(q++,y,z)):q===b.firstPickIndex+1?(b.l(q++,v,A),b.l(q++,B,A)):(null!==y?y.centerX:v)!==B&&(y=this.Ka[w.layer-1]+this.Sc.y,b.l(q++,v,y),b.l(q++,B,y));else if(q===b.firstPickIndex+1){y=Math.max(10,this.ae[n.layer]);var E=Math.max(10,this.yd[n.layer]);if(r)180===this.K?B<=n.bounds.x?(n=n.bounds.x,b.l(q++,n-y,z),b.l(q++,n,z),b.l(q++,n+E,z)):(b.l(q++,B-y,z),b.l(q++,B,z),b.l(q++,B+E,z)):90===this.K?
z>=n.bounds.bottom?(n=n.bounds.y+n.bounds.height,b.l(q++,B,n+E),b.l(q++,B,n),b.l(q++,B,n-y)):(b.l(q++,B,z+E),b.l(q++,B,z),b.l(q++,B,z-y)):270===this.K?z<=n.bounds.y?(n=n.bounds.y,b.l(q++,B,n-y),b.l(q++,B,n),b.l(q++,B,n+E)):(b.l(q++,B,z-y),b.l(q++,B,z),b.l(q++,B,z+E)):0===this.K&&(B>=n.bounds.right?(n=n.bounds.x+n.bounds.width,b.l(q++,n+E,z),b.l(q++,n,z),b.l(q++,n-y,z)):(b.l(q++,B+E,z),b.l(q++,B,z),b.l(q++,B-y,z)));else{b.l(q++,v,A);var K=0;if(180===this.K||0===this.K){if(180===this.K?B>=n.bounds.right:
B<=n.bounds.x)K=(0===this.K?-y:E)/2;b.l(q++,v+K,z)}else{if(270===this.K?z>=n.bounds.bottom:z<=n.bounds.y)K=(90===this.K?-y:E)/2;b.l(q++,B,A+K)}b.l(q++,B,z)}}else y=Math.max(10,this.ae[w.layer]),E=Math.max(10,this.yd[w.layer]),r?180===this.K?(b.l(q++,B-y-u,z),b.l(q++,Math.min(B-y+u/2,B),z),b.l(q++,B,z),b.l(q++,B,z),b.l(q++,Math.max(B+E-u/2,B),z),b.l(q++,B+E+u,z)):90===this.K?(b.l(q++,B,z+E+u),b.l(q++,B,Math.max(z+E-u/2,z)),b.l(q++,B,z),b.l(q++,B,z),b.l(q++,B,Math.min(z-y+u/2,z)),b.l(q++,B,z-y-u)):
270===this.K?(b.l(q++,B,z-y-u),b.l(q++,B,Math.min(z-y+u/2,z)),b.l(q++,B,z),b.l(q++,B,z),b.l(q++,B,Math.max(z+E-u/2,z)),b.l(q++,B,z+E+u)):(b.l(q++,B+E+u,z),b.l(q++,Math.max(B+E-u/2,B),z),b.l(q++,B,z),b.l(q++,B,z),b.l(q++,Math.min(B-y+u/2,B),z),b.l(q++,B-y-u,z)):b.l(q++,B,z)}n=w}if(null===h||l!==qc||p)if(v=b.i(q-1).x,A=b.i(q-1).y,B=b.i(q).x,z=b.i(q).y,p)u=this.yd[m.layer],180===this.K||0===this.K?(p=A,p>=m.bounds.y&&p<=m.bounds.bottom&&(180===this.K?B>=m.bounds.x:B<=m.bounds.right)&&(n=m.centerX+(180===
this.K?-u:u),p<m.bounds.y+m.bounds.height/2?p=m.bounds.y-this.ac/2:p=m.bounds.bottom+this.ac/2,b.l(q++,n,A),b.l(q++,n,p)),b.l(q++,B,p)):(p=v,p>=m.bounds.x&&p<=m.bounds.right&&(270===this.K?z>=m.bounds.y:z<=m.bounds.bottom)&&(n=m.centerY+(270===this.K?-u:u),p<m.bounds.x+m.bounds.width/2?p=m.bounds.x-this.ac/2:p=m.bounds.right+this.ac/2,b.l(q++,v,n),b.l(q++,p,n)),b.l(q++,p,z)),b.l(q++,B,z);else if(r)y=Math.max(10,this.ae[m.layer]),E=Math.max(10,this.yd[m.layer]),180===this.K&&B>=m.bounds.x?(n=m.bounds.x+
m.bounds.width,b.M(q-2,n,A),b.M(q-1,n+E,A)):90===this.K&&z<=m.bounds.bottom?(n=m.bounds.y,b.M(q-2,v,n),b.M(q-1,v,n-y)):270===this.K&&z>=m.bounds.y?(n=m.bounds.y+m.bounds.height,b.M(q-2,v,n),b.M(q-1,v,n+E)):0===this.K&&B<=m.bounds.right&&(n=m.bounds.x,b.M(q-2,n,A),b.M(q-1,n-y,A));else{y=Math.max(10,this.ae[m.layer]);E=Math.max(10,this.yd[m.layer]);p=0;if(180===this.K||0===this.K){if(180===this.K?B<=m.bounds.x:B>=m.bounds.right)p=(0===this.K?E:-y)/2;b.l(q++,B+p,A)}else{if(270===this.K?z<=m.bounds.y:
z>=m.bounds.bottom)p=(90===this.K?E:-y)/2;b.l(q++,v,z+p)}b.l(q++,B,z)}}else{for(;null!==m&&m!==n;){y=w=null;for(m=m.destinationEdges.iterator;m.next()&&(v=m.value,v.link!==c.link||(w=v.toVertex,y=v.fromVertex,null!==y.node&&(y=null),null!==w.node)););if(null===w)break;w!==n&&(v=b.i(q-1).x,A=b.i(q-1).y,B=w.centerX,z=w.centerY,p?180===this.K||0===this.K?(null!==y?y.centerY:A)!==z&&(y=this.Ka[w.layer]+this.Sc.x,q===b.firstPickIndex+1&&(y=0===this.K?Math.max(y,v):Math.min(y,v)),b.l(q++,y,A),b.l(q++,y,
z)):(null!==y?y.centerX:v)!==B&&(y=this.Ka[w.layer]+this.Sc.y,q===b.firstPickIndex+1&&(y=90===this.K?Math.max(y,A):Math.min(y,A)),b.l(q++,v,y),b.l(q++,B,y)):(y=Math.max(10,this.ae[w.layer]),E=Math.max(10,this.yd[w.layer]),r?180===this.K?(b.l(q++,B+E+u,z),b.l(q++,Math.max(B+E-u/2,B),z),b.l(q++,B,z),b.l(q++,B,z),b.l(q++,Math.min(B-y+u/2,B),z),b.l(q++,B-y-u,z)):90===this.K?(b.l(q++,B,z-y-u),b.l(q++,B,Math.min(z-y+u/2,z)),b.l(q++,B,z),b.l(q++,B,z),b.l(q++,B,Math.max(z+E-u/2,z)),b.l(q++,B,z+E+u)):270===
this.K?(b.l(q++,B,z+E+u),b.l(q++,B,Math.max(z+E-u/2,z)),b.l(q++,B,z),b.l(q++,B,z),b.l(q++,B,Math.min(z-y+u/2,z)),b.l(q++,B,z-y-u)):(b.l(q++,B-y-u,z),b.l(q++,Math.min(B-y+u/2,B),z),b.l(q++,B,z),b.l(q++,B,z),b.l(q++,Math.max(B+E-u/2,B),z),b.l(q++,B+E+u,z)):180===this.K?(b.l(q++,B+E,z),b.l(q++,B-y,z)):90===this.K?(b.l(q++,B,z-y),b.l(q++,B,z+E)):270===this.K?(b.l(q++,B,z+E),b.l(q++,B,z-y)):(b.l(q++,B-y,z),b.l(q++,B+E,z))));m=w}p&&(v=b.i(q-1).x,A=b.i(q-1).y,B=b.i(q).x,z=b.i(q).y,180===this.K||0===this.K?
A!==z&&(y=0===this.K?Math.min(Math.max((B+v)/2,this.Ka[n.layer]+this.Sc.x),B):Math.max(Math.min((B+v)/2,this.Ka[n.layer]+this.Sc.x),B),b.l(q++,y,A),b.l(q++,y,z)):v!==B&&(y=90===this.K?Math.min(Math.max((z+A)/2,this.Ka[n.layer]+this.Sc.y),z):Math.max(Math.min((z+A)/2,this.Ka[n.layer]+this.Sc.y),z),b.l(q++,v,y),b.l(q++,B,y)))}null!==d&&r&&(null!==g&&(l===qc&&(l=b.i(0),d=b.i(2),l.A(d)||b.M(1,(l.x+d.x)/2,(l.y+d.y)/2)),l=b.getLinkPoint(e,g,qc,!0,!1,f,h),l.u()||l.set(e.actualBounds.center),b.M(0,l.x,l.y)),
null!==h&&(k===qc&&(k=b.i(b.pointsCount-1),l=b.i(b.pointsCount-3),k.A(l)||b.M(b.pointsCount-2,(k.x+l.x)/2,(k.y+l.y)/2)),e=b.getLinkPoint(f,h,qc,!1,!1,e,g),e.u()||e.set(f.actualBounds.center),b.M(b.pointsCount-1,e.x,e.y)));b.vf();c.commit()}}}this.avoidOrthogonalOverlaps()};
ks.prototype.avoidOrthogonalOverlaps=function(){if(!(0>=this.linkSpacing)){for(var a=new F,b=this.network.edges.iterator;b.next();){var c=b.value.link;null!==c&&c.isOrthogonal&&!a.contains(c)&&a.add(c)}if(0<a.count)if(90===this.K||270===this.K){b=0;c=[];for(a=a.iterator;a.next();){var d=a.value;if(null!==d&&d.isOrthogonal)for(var e=2;e<d.pointsCount-3;e++){var f=d.i(e);var g=d.i(e+1);if(this.w(f.y,g.y)&&!this.w(f.x,g.x)){var h=new et;h.layer=Math.floor(f.y/2);var k=d.i(0),l=d.i(d.pointsCount-1);h.first=
k.x*k.x+k.y;h.$b=l.x*l.x+l.y;h.fd=Math.min(f.x,g.x);h.wc=Math.max(f.x,g.x);h.index=e;h.link=d;if(e+2<d.pointsCount){k=d.i(e-1);l=d.i(e+2);var m=0;k.y<f.y?m=l.y<f.y?3:f.x<g.x?2:1:k.y>f.y&&(m=l.y>f.y?0:g.x<f.x?2:1);h.j=m}c.push(h)}}}if(1<c.length)for(c.sort(this.uy),a=0;a<c.length;){f=c[a].layer;for(d=a+1;d<c.length&&c[d].layer===f;)d++;if(1<d-a)for(f=a;f<d;){g=c[f].wc;for(e=a+1;e<d&&c[e].fd<g;)g=Math.max(g,c[e].wc),e++;g=e-f;if(1<g){this.Vi(c,this.Qs,f,f+g);m=1;h=c[f].$b;for(k=f;k<e;k++)l=c[k],l.$b!==
h&&(m++,h=l.$b);this.Vi(c,this.ty,f,f+g);var n=1;h=c[f].first;for(k=f;k<e;k++)l=c[k],l.first!==h&&(n++,h=l.first);k=!0;l=n;m<n?(k=!1,l=m,h=c[f].$b,this.Vi(c,this.Qs,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++){var p=c[n];(k?p.first:p.$b)!==h&&(m++,h=k?p.first:p.$b);var r=p.link;f=r.i(p.index);g=r.i(p.index+1);var q=this.linkSpacing*(m-(l-1)/2);b++;r.Lh();r.M(p.index,f.x,f.y+q);r.M(p.index+1,g.x,g.y+q);r.vf()}}f=e}a=d}}else{b=0;c=[];for(a=a.iterator;a.next();)if(d=a.value,null!==d&&d.isOrthogonal)for(e=
2;e<d.pointsCount-3;e++)f=d.i(e),g=d.i(e+1),this.w(f.x,g.x)&&!this.w(f.y,g.y)&&(h=new et,h.layer=Math.floor(f.x/2),k=d.i(0),l=d.i(d.pointsCount-1),h.first=k.x+k.y*k.y,h.$b=l.x+l.y*l.y,h.fd=Math.min(f.y,g.y),h.wc=Math.max(f.y,g.y),h.index=e,h.link=d,e+2<d.pointsCount&&(k=d.i(e-1),l=d.i(e+2),m=0,k.x<f.x?m=l.x<f.x?3:f.y<g.y?2:1:k.x>f.x&&(m=l.x>f.x?0:g.y<f.y?2:1),h.j=m),c.push(h));if(1<c.length)for(c.sort(this.uy),a=0;a<c.length;){f=c[a].layer;for(d=a+1;d<c.length&&c[d].layer===f;)d++;if(1<d-a)for(f=
a;f<d;){g=c[f].wc;for(e=a+1;e<d&&c[e].fd<g;)g=Math.max(g,c[e].wc),e++;g=e-f;if(1<g){this.Vi(c,this.Qs,f,f+g);m=1;h=c[f].$b;for(k=f;k<e;k++)l=c[k],l.$b!==h&&(m++,h=l.$b);this.Vi(c,this.ty,f,f+g);n=1;h=c[f].first;for(k=f;k<e;k++)l=c[k],l.first!==h&&(n++,h=l.first);k=!0;l=n;m<n?(k=!1,l=m,h=c[f].$b,this.Vi(c,this.Qs,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++)p=c[n],(k?p.first:p.$b)!==h&&(m++,h=k?p.first:p.$b),r=p.link,f=r.i(p.index),g=r.i(p.index+1),q=this.linkSpacing*(m-(l-1)/2),b++,r.Lh(),r.M(p.index,
f.x+q,f.y),r.M(p.index+1,g.x+q,g.y),r.vf()}f=e}a=d}}}};t=ks.prototype;t.uy=function(a,b){return a instanceof et&&b instanceof et&&a!==b?a.layer<b.layer?-1:a.layer>b.layer?1:a.fd<b.fd?-1:a.fd>b.fd?1:a.wc<b.wc?-1:a.wc>b.wc?1:0:0};t.ty=function(a,b){return a instanceof et&&b instanceof et&&a!==b?a.first<b.first?-1:a.first>b.first||a.j<b.j?1:a.j>b.j||a.fd<b.fd?-1:a.fd>b.fd?1:a.wc<b.wc?-1:a.wc>b.wc?1:0:0};
t.Qs=function(a,b){return a instanceof et&&b instanceof et&&a!==b?a.$b<b.$b?-1:a.$b>b.$b||a.j<b.j?1:a.j>b.j||a.fd<b.fd?-1:a.fd>b.fd?1:a.wc<b.wc?-1:a.wc>b.wc?1:0:0};t.w=function(a,b){a-=b;return-1<a&&1>a};
t.Vi=function(a,b,c,d){var e=a.length,f=d-c;if(!(1>=f))if((0>c||c>=e-1)&&C("not in range 0 <= from < length: "+c),2===f)d=a[c],e=a[c+1],0<b(d,e)&&(a[c]=e,a[c+1]=d);else if(0===c)if(d>=e)a.sort(b);else for(c=a.slice(0,d),c.sort(b),b=0;b<d;b++)a[b]=c[b];else if(d>=e)for(d=a.slice(c),d.sort(b),b=c;b<e;b++)a[b]=d[b-c];else for(e=a.slice(c,d),e.sort(b),b=c;b<d;b++)a[b]=e[b-c]};
function ts(a,b){var c=a.Ab[b];if(c>=a.ye.length){var d=[];for(var e=0;e<a.ye.length;e++)d[e]=a.ye[e];a.ye=d}void 0===a.ye[c]||null===a.ye[c]?d=[]:(d=a.ye[c],a.ye[c]=null);a=a.zo[b];for(b=0;b<a.length;b++)c=a[b],d[c.index]=c;return d}function us(a,b,c){a.ye[a.Ab[b]]=c}
na.Object.defineProperties(ks.prototype,{layerSpacing:{get:function(){return this.be},set:function(a){this.be!==a&&0<=a&&(this.be=a,this.B())}},columnSpacing:{get:function(){return this.ac},set:function(a){this.ac!==a&&0<a&&(this.ac=a,this.B())}},direction:{get:function(){return this.K},set:function(a){this.K!==a&&(0===a||90===a||180===a||270===a?(this.K=a,this.B()):C("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}},
cycleRemoveOption:{get:function(){return this.Kk},set:function(a){this.Kk===a||a!==Es&&a!==ls&&a!==qs||(this.Kk=a,this.B())}},layeringOption:{get:function(){return this.il},set:function(a){this.il===a||a!==ms&&a!==Js&&a!==Ls||(this.il=a,this.B())}},initializeOption:{get:function(){return this.Zk},set:function(a){this.Zk===a||a!==ns&&a!==Rs&&a!==Ps||(this.Zk=a,this.B())}},iterations:{
get:function(){return this.qj},set:function(a){this.qj!==a&&0<=a&&(this.qj=a,this.B())}},aggressiveOption:{get:function(){return this.vk},set:function(a){this.vk===a||a!==Vs&&a!==os&&a!==Ws||(this.vk=a,this.B())}},packOption:{get:function(){return this.ag},set:function(a){this.ag!==a&&0<=a&&8>a&&(this.ag=a,this.B())}},setsPortSpots:{get:function(){return this.hf},set:function(a){this.hf!==a&&(this.hf=a,this.B())}},
linkSpacing:{get:function(){return this.jo},set:function(a){this.jo!==a&&0<=a&&(this.jo=a,this.B())}},maxLayer:{get:function(){return this.ra}},maxIndex:{get:function(){return this.ji}},maxColumn:{get:function(){return this.Ea}},minIndexLayer:{get:function(){return this.Vg}},maxIndexLayer:{get:function(){return this.tc}}});
var ls=new D(ks,"CycleDepthFirst",0),Es=new D(ks,"CycleGreedy",1),qs=new D(ks,"CycleFromLayers",2),ms=new D(ks,"LayerOptimalLinkLength",0),Js=new D(ks,"LayerLongestPathSink",1),Ls=new D(ks,"LayerLongestPathSource",2),ns=new D(ks,"InitDepthFirstOut",0),Rs=new D(ks,"InitDepthFirstIn",1),Ps=new D(ks,"InitNaive",2),Vs=new D(ks,"AggressiveNone",0),os=new D(ks,"AggressiveLess",1),Ws=new D(ks,"AggressiveMore",2),Xs=8;ks.className="LayeredDigraphLayout";ks.CycleDepthFirst=ls;ks.CycleGreedy=Es;
ks.CycleFromLayers=qs;ks.LayerOptimalLinkLength=ms;ks.LayerLongestPathSink=Js;ks.LayerLongestPathSource=Ls;ks.InitDepthFirstOut=ns;ks.InitDepthFirstIn=Rs;ks.InitNaive=Ps;ks.AggressiveNone=Vs;ks.AggressiveLess=os;ks.AggressiveMore=Ws;ks.PackNone=0;ks.PackExpand=1;ks.PackStraighten=2;ks.PackMedian=4;ks.PackAll=15;function et(){this.index=this.wc=this.fd=this.$b=this.first=this.layer=0;this.link=null;this.j=0}et.className="SegInfo";function ps(a){Op.call(this,a)}ma(ps,Op);ps.prototype.createVertex=function(){return new ft(this)};
ps.prototype.createEdge=function(){return new gt(this)};ps.className="LayeredDigraphNetwork";function ft(a){bq.call(this,a);this.Ra=this.Bg=this.fi=-1;this.D=NaN;this.L=null;this.valid=!1;this.finish=this.og=NaN;this.uf=0;this.hk=this.ik=null}ma(ft,bq);
ft.prototype.serializeVertexProperties=function(a,b){bq.prototype.serializeVertexProperties.call(this,a,b);a.layer=this.layer;a.column=this.column;a.index=this.index;a.component=this.component;a.near=this.near?fb(this.near):null;a.valid=this.valid;a.og=this.og;a.finish=this.finish;a.uf=this.uf;a.ik=this.ik;a.hk=this.hk};
ft.prototype.deserializeVertexProperties=function(a,b,c,d){bq.prototype.deserializeVertexProperties.call(this,a,b,c,d);this.layer=a.layer;this.column=a.column;this.index=a.index;this.component=a.component;if(b=b.get(a.near))this.near=b;this.valid=a.valid;this.og=a.og;this.finish=a.finish;this.uf=a.uf;this.ik=a.ik;this.hk=a.hk};
na.Object.defineProperties(ft.prototype,{layer:{get:function(){return this.fi},set:function(a){this.fi!==a&&(this.fi=a)}},column:{get:function(){return this.Bg},set:function(a){this.Bg!==a&&(this.Bg=a)}},index:{get:function(){return this.Ra},set:function(a){this.Ra!==a&&(this.Ra=a)}},component:{get:function(){return this.D},set:function(a){this.D!==a&&(this.D=a)}},near:{
get:function(){return this.L},set:function(a){this.L!==a&&(this.L=a)}}});ft.className="LayeredDigraphVertex";function gt(a){cq.call(this,a);this.j=this.Ba=this.Ma=!1;this.wa=this.D=NaN;this.L=this.o=0}ma(gt,cq);
gt.prototype.serializeEdgeProperties=function(a,b){cq.prototype.serializeEdgeProperties.call(this,a,b);a.valid=this.valid;a.rev=this.rev;a.forest=this.forest;a.portFromPos=this.portFromPos;a.portToPos=this.portToPos;a.portFromColOffset=this.portFromColOffset;a.portToColOffset=this.portToColOffset};
gt.prototype.deserializeEdgeProperties=function(a,b,c,d){cq.prototype.deserializeEdgeProperties.call(this,a,b,c,d);this.valid=a.valid;this.rev=a.rev;this.forest=a.forest;this.portFromPos=a.portFromPos;this.portToPos=a.portToPos;this.portFromColOffset=a.portFromColOffset;this.portToColOffset=a.portToColOffset};
na.Object.defineProperties(gt.prototype,{fromVertex:{get:function(){return this.Vc},set:function(a){this.Vc!==a&&(this.Vc=a)}},toVertex:{get:function(){return this.dd},set:function(a){this.dd!==a&&(this.dd=a)}},valid:{get:function(){return this.Ma},set:function(a){this.Ma!==a&&(this.Ma=a)}},rev:{get:function(){return this.Ba},set:function(a){this.Ba!==a&&(this.Ba=a)}},forest:{
get:function(){return this.j},set:function(a){this.j!==a&&(this.j=a)}},portFromPos:{get:function(){return this.D},set:function(a){this.D!==a&&(this.D=a)}},portToPos:{get:function(){return this.wa},set:function(a){this.wa!==a&&(this.wa=a)}},portFromColOffset:{get:function(){return this.o},set:function(a){this.o!==a&&(this.o=a)}},portToColOffset:{get:function(){return this.L},
set:function(a){this.L!==a&&(this.L=a)}}});gt.className="LayeredDigraphEdge";function ht(a){mi.call(this);this.Kb=new G;this.Mo=it;this.md=jt;this.Ep=kt;this.tr=lt;this.Aw=[];this.kd=!0;this.Hb=mt;this.Qd=(new Fb(10,10)).freeze();var b=new nt(this);this.V=new ot(b);this.W=new ot(b);this.ku=[];a&&Object.assign(this,a)}ma(ht,mi);
ht.prototype.cloneProtected=function(a){mi.prototype.cloneProtected.call(this,a);a.Mo=this.Mo;a.Ep=this.Ep;a.tr=this.tr;a.kd=this.kd;a.Hb=this.Hb;a.Qd.assign(this.Qd);a.V.copyInheritedPropertiesFrom(this.V);a.W.copyInheritedPropertiesFrom(this.W)};
ht.prototype.gb=function(a){a.classType===ht?0===a.name.indexOf("Alignment")?this.alignment=a:0===a.name.indexOf("Arrangement")?this.arrangement=a:0===a.name.indexOf("Compaction")?this.compaction=a:0===a.name.indexOf("Path")?this.path=a:0===a.name.indexOf("Sorting")?this.sorting=a:0===a.name.indexOf("Style")?this.treeStyle=a:C("Unknown enum value: "+a):mi.prototype.gb.call(this,a)};ht.prototype.createNetwork=function(){return new nt(this)};
ht.prototype.makeNetwork=function(a){function b(a){if(a instanceof W)return!a.isLinkLabel&&"Comment"!==a.category;if(a instanceof T){var b=a.fromNode;if(null===b||b.isLinkLabel||"Comment"===b.category)return!1;a=a.toNode;return null===a||a.isLinkLabel||"Comment"===a.category?!1:!0}return!1}var c=this.createNetwork();a instanceof R?(c.mg(a.nodes,!0,b),c.mg(a.links,!0,b)):a instanceof U?c.mg(a.memberParts,!1,b):c.mg(a.iterator,!1,b);return c};
ht.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangement!==pt&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var b=this.diagram;null===b&&a instanceof R&&(b=a);this.path===it&&null!==b?this.md=b.isTreePathToChildren?jt:qt:this.md=this.path===it?jt:this.path;if(0<this.network.vertexes.count){this.network.Sp();for(a=this.network.vertexes.iterator;a.next();)b=a.value,b.initialized=!1,b.level=0,b.parent=null,b.children=[];if(0<this.Kb.count){a=
new G;for(b=this.Kb.iterator;b.next();){var c=b.value;c instanceof W?(c=this.network.Ji(c),null!==c&&a.add(c)):c instanceof ot&&a.add(c)}this.Kb=a}0===this.Kb.count&&this.findRoots();for(a=this.Kb.copy().iterator;a.next();)b=a.value,b.initialized||(b.initialized=!0,rt(this,b));b=this.network.vertexes;for(a=null;a=st(b),0<a.count;)b=tt(this,a),null!==b&&this.Kb.add(b),b.initialized=!0,rt(this,b),b=a;for(a=this.Kb.iterator;a.next();)b=a.value,b instanceof ot&&ut(this,b);for(a=this.Kb.iterator;a.next();)b=
a.value,b instanceof ot&&vt(this,b);for(a=this.Kb.iterator;a.next();)b=a.value,b instanceof ot&&wt(this,b);this.vu();if(this.layerStyle===xt){a=[];for(b=this.network.vertexes.iterator;b.next();){c=b.value;var d=c.parent;null===d&&(d=c);d=0===d.angle||180===d.angle;var e=a[c.level];void 0===e&&(e=0);a[c.level]=Math.max(e,d?c.width:c.height)}for(b=0;b<a.length;b++)void 0===a[b]&&(a[b]=0);this.Aw=a;for(b=this.network.vertexes.iterator;b.next();)c=b.value,d=c.parent,null===d&&(d=c),0===d.angle||180===
d.angle?(180===d.angle&&(c.focusX+=a[c.level]-c.width),c.width=a[c.level]):(270===d.angle&&(c.focusY+=a[c.level]-c.height),c.height=a[c.level])}else if(this.layerStyle===yt)for(a=this.network.vertexes.iterator;a.next();){b=a.value;c=0===b.angle||180===b.angle;d=-1;for(e=0;e<b.children.length;e++){var f=b.children[e];d=Math.max(d,c?f.width:f.height)}if(0<=d)for(e=0;e<b.children.length;e++)f=b.children[e],c?(180===b.angle&&(f.focusX+=d-f.width),f.width=d):(270===b.angle&&(f.focusY+=d-f.height),f.height=
d)}for(a=this.Kb.iterator;a.next();)b=a.value,b instanceof ot&&this.layoutTree(b);this.arrangeTrees();this.updateParts()}this.network=null;this.Kb=new G;this.isValidLayout=!0};function st(a){var b=new G;for(a=a.iterator;a.next();){var c=a.value;c.initialized||b.add(c)}return b}
ht.prototype.findRoots=function(){for(var a=this.network.vertexes,b=a.iterator;b.next();){var c=b.value;switch(this.md){case jt:0===c.sourceEdges.count&&this.Kb.add(c);break;case qt:0===c.destinationEdges.count&&this.Kb.add(c);break;default:C("Unhandled path value "+this.md.toString())}}0===this.Kb.count&&(a=tt(this,a),null!==a&&this.Kb.add(a))};
function tt(a,b){var c=999999,d=null;for(b=b.iterator;b.next();){var e=b.value;switch(a.md){case jt:e.sourceEdges.count<c&&(c=e.sourceEdges.count,d=e);break;case qt:e.destinationEdges.count<c&&(c=e.destinationEdges.count,d=e);break;default:C("Unhandled path value "+a.md.toString())}}return d}
function rt(a,b){if(null!==b){switch(a.md){case jt:if(0<b.destinationEdges.count){for(var c=new F,d=b.destinationVertexes;d.next();){var e=d.value;zt(a,b,e)&&c.add(e)}0<c.count&&(b.children=c.ya())}break;case qt:if(0<b.sourceEdges.count){c=new F;for(d=b.sourceVertexes;d.next();)e=d.value,zt(a,b,e)&&c.add(e);0<c.count&&(b.children=c.ya())}break;default:C("Unhandled path value"+a.md.toString())}c=b.children;d=c.length;for(e=0;e<d;e++){var f=c[e];f.initialized=!0;f.level=b.level+1;f.parent=b;a.Kb.remove(f)}for(b=
0;b<d;b++)rt(a,c[b])}}function zt(a,b,c){if(c.initialized){if(null===b)var d=!1;else{for(d=b.parent;null!==d&&d!==c;)d=d.parent;d=d===c}if(d||c.level>b.level)return!1;a.removeChild(c.parent,c)}return!0}ht.prototype.removeChild=function(a,b){if(null!==a&&null!==b){for(var c=a.children,d=0,e=0;e<c.length;e++)c[e]===b&&d++;if(0<d){d=Array(c.length-d);for(var f=e=0;f<c.length;f++)c[f]!==b&&(d[e++]=c[f]);a.children=d}}};
function ut(a,b){if(null!==b){a.initializeTreeVertexValues(b);b.alignment===At&&a.sortTreeVertexChildren(b);for(var c=0,d=b.childrenCount,e=0,f=b.children,g=f.length,h=0;h<g;h++){var k=f[h];ut(a,k);c+=k.descendantCount+1;d=Math.max(d,k.maxChildrenCount);e=Math.max(e,k.maxGenerationCount)}b.descendantCount=c;b.maxChildrenCount=d;b.maxGenerationCount=0<d?e+1:0}}
function Bt(a,b){switch(a.Ep){default:case kt:return null!==b.parent?b.parent:a.V;case Ct:return null===b.parent?a.V:null===b.parent.parent?a.W:b.parent;case Dt:return null!==b.parent?null!==b.parent.parent?b.parent.parent:a.W:a.V;case Et:var c=!0;if(0===b.childrenCount)c=!1;else for(var d=b.children,e=d.length,f=0;f<e;f++)if(0<d[f].childrenCount){c=!1;break}return c&&null!==b.parent?a.W:null!==b.parent?b.parent:a.V}}
ht.prototype.initializeTreeVertexValues=function(a){a.copyInheritedPropertiesFrom(Bt(this,a));if(null!==a.parent&&a.parent.alignment===At){for(var b=a.angle,c=a.parent.children,d=0;d<c.length&&a!==c[d];)d++;0===d%2?d!==c.length-1&&(b=90===b?180:180===b?270:270===b?180:270):b=90===b?0:180===b?90:270===b?0:90;a.angle=b}a.initialized=!0};function vt(a,b){if(null!==b){a.assignTreeVertexValues(b);b=b.children;for(var c=b.length,d=0;d<c;d++)vt(a,b[d])}}ht.prototype.assignTreeVertexValues=function(){};
function wt(a,b){if(null!==b){b.alignment!==At&&a.sortTreeVertexChildren(b);b=b.children;for(var c=b.length,d=0;d<c;d++)wt(a,b[d])}}ht.prototype.sortTreeVertexChildren=function(a){switch(a.sorting){case Ft:break;case Gt:a.children.reverse();break;case Ht:a.children.sort(a.comparer);break;case It:a.children.sort(a.comparer);a.children.reverse();break;default:C("Unhandled sorting value "+a.sorting.toString())}};ht.prototype.vu=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
ht.prototype.addComments=function(a){var b=a.angle,c=a.parent,d=0;var e=!1;null!==c&&(d=c.angle,e=c.alignment,e=Jt(e));b=90===b||270===b;d=90===d||270===d;c=0===a.childrenCount;var f=0,g=0,h=0,k=a.commentSpacing;if(null!==a.node)for(var l=a.node.Nu();l.next();){var m=l.value;"Comment"===m.category&&m.canLayout()&&(null===a.comments&&(a.comments=[]),a.comments.push(m),m.Ta(),m=m.measuredBounds,b&&!c||!e&&!d&&c||e&&d&&c?(f=Math.max(f,m.width),g+=m.height+Math.abs(h)):(f+=m.width+Math.abs(h),g=Math.max(g,
m.height)),h=k)}null!==a.comments&&(b&&!c||!e&&!d&&c||e&&d&&c?(f+=Math.abs(a.commentMargin),g=Math.max(0,g-a.height)):(g+=Math.abs(a.commentMargin),f=Math.max(0,f-a.width)),e=M.allocAt(0,0,a.bounds.width+f,a.bounds.height+g),a.bounds=e,M.free(e))};function Jt(a){return a===Kt||a===At||a===Lt||a===Mt}function Nt(a){return a===Kt||a===At}
function Ot(a){var b=a.parent;if(null!==b){var c=b.alignment;if(Jt(c)){if(Nt(c)){b=b.children;for(c=0;c<b.length&&a!==b[c];)c++;return 0===c%2}if(c===Lt)return!0}}return!1}
ht.prototype.layoutComments=function(a){if(null!==a.comments){var b=a.node.measuredBounds,c=a.parent,d=a.angle,e=0;var f=!1;null!==c&&(e=c.angle,f=c.alignment,f=Jt(f));d=90===d||270===d;c=90===e||270===e;for(var g=0===a.childrenCount,h=Ot(a),k=0,l=a.comments,m=l.length,n=J.alloc(),p=0;p<m;p++){var r=l[p],q=r.measuredBounds;if(d&&!g||!f&&!c&&g||f&&c&&g){if(135<e&&!f||c&&h)if(0<=a.commentMargin)for(n.h(a.bounds.x-a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.Gd();r.next();){var u=r.value;u.fromSpot=
ad;u.toSpot=bd}else for(n.h(a.bounds.x+2*a.focus.x-a.commentMargin,a.bounds.y+k),r.move(n),r=r.Gd();r.next();)u=r.value,u.fromSpot=bd,u.toSpot=ad;else if(0<=a.commentMargin)for(n.h(a.bounds.x+2*a.focus.x+a.commentMargin,a.bounds.y+k),r.move(n),r=r.Gd();r.next();)u=r.value,u.fromSpot=bd,u.toSpot=ad;else for(n.h(a.bounds.x+a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.Gd();r.next();)u=r.value,u.fromSpot=ad,u.toSpot=bd;k=0<=a.commentSpacing?k+(q.height+a.commentSpacing):k+(a.commentSpacing-q.height)}else{if(135<
e&&!f||!c&&h)if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y-a.commentMargin-q.height),r.move(n),r=r.Gd();r.next();)u=r.value,u.fromSpot=$c,u.toSpot=cd;else for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y-a.commentMargin),r.move(n),r=r.Gd();r.next();)u=r.value,u.fromSpot=cd,u.toSpot=$c;else if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y+a.commentMargin),r.move(n),r=r.Gd();r.next();)u=r.value,u.fromSpot=cd,u.toSpot=$c;else for(n.h(a.bounds.x+k,a.bounds.y+a.commentMargin-q.height),
r.move(n),r=r.Gd();r.next();)u=r.value,u.fromSpot=$c,u.toSpot=cd;k=0<=a.commentSpacing?k+(q.width+a.commentSpacing):k+(a.commentSpacing-q.width)}}J.free(n);b=k-a.commentSpacing-(d?b.height:b.width);if(this.md===jt)for(a=a.destinationEdges;a.next();)e=a.value.link,null===e||e.isAvoiding||(e.fromEndSegmentLength=0<b?b:NaN);else for(a=a.sourceEdges;a.next();)e=a.value.link,null===e||e.isAvoiding||(e.toEndSegmentLength=0<b?b:NaN)}};
ht.prototype.layoutTree=function(a){if(null!==a){for(var b=a.children,c=b.length,d=0;d<c;d++)this.layoutTree(b[d]);switch(a.compaction){case Pt:Qt(this,a);break;case Wt:if(a.alignment===At)Qt(this,a);else if(0===a.childrenCount)d=a.parent,c=!1,b=0,null!==d&&(b=d.angle,c=d.alignment,c=Jt(c)),d=Ot(a),a.U.h(0,0),a.va.h(a.width,a.height),null===a.parent||null===a.comments||(180!==b&&270!==b||c)&&!d?a.fa.h(0,0):180===b&&!c||(90===b||270===b)&&d?a.fa.h(a.width-2*a.focus.x,0):a.fa.h(0,a.height-2*a.focus.y),
a.fq=null,a.rq=null;else{var e=Xt(a);b=90===e||270===e;var f=0,g=a.children,h=g.length;for(c=0;c<h;c++)d=g[c],f=Math.max(f,b?d.va.width:d.va.height);var k=a.alignment,l=k===Yt,m=Jt(k),n=Math.max(0,a.breadthLimit);c=Zt(a);var p=a.nodeSpacing,r=$t(a),q=a.rowSpacing,u=0;if(k===au||l||a.rm||a.sm&&1===a.maxGenerationCount)u=Math.max(0,a.rowIndent);d=a.width;var w=a.height,v=0,A=0,y=0,B=null,z=null,E=0,K=0,O=0,S=0,Q=0,H=0,da=0,ba=0;m&&!Nt(k)&&135<e&&g.reverse();if(Nt(k))if(1<h)for(var pa=0;pa<h;pa++)0===
pa%2&&pa!==h-1&&(ba=Math.max(ba,b?g[pa].va.width:g[pa].va.height));else 1===h&&(ba=b?g[0].va.width:g[0].va.height);if(m){switch(k){case Kt:A=135>e?bu(a,g,ba,v,A):cu(a,g,ba,v,A);ba=A.x;v=A.width;A=A.height;break;case Lt:for(B=0;B<h;B++)z=g[B],n=z.va,y=0===H?0:q,b?(z.U.h(f-n.width,S+y),v=Math.max(v,n.width),A=Math.max(A,S+y+n.height),S+=y+n.height):(z.U.h(O+y,f-n.height),v=Math.max(v,O+y+n.width),A=Math.max(A,n.height),O+=y+n.width),H++;break;case Mt:for(B=0;B<h;B++)z=g[B],f=z.va,n=0===H?0:q,b?(z.U.h(p/
2+a.focus.x,S+n),v=Math.max(v,f.width),A=Math.max(A,S+n+f.height),S+=n+f.height):(z.U.h(O+n,p/2+a.focus.y),v=Math.max(v,O+n+f.width),A=Math.max(A,f.height),O+=n+f.width),H++}B=du(this,2);z=du(this,2);b?(B[0].h(0,0),B[1].h(0,A),z[0].h(v,0)):(B[0].h(0,0),B[1].h(v,0),z[0].h(0,A));z[1].h(v,A)}else for(pa=0;pa<h;pa++){var Ca=g[pa],cb=Ca.va;if(b){0<n&&0<H&&O+p+cb.width>n&&(O<f&&eu(a,k,f-O,0,da,pa-1),Q++,H=0,da=pa,y=A,O=0,S=135<e?-A-q:A+q);fu(this,Ca,0,S);var Ia=0;if(0===H){if(B=Ca.fq,z=Ca.rq,E=cb.width,
K=cb.height,null===B||null===z||e!==Xt(Ca))B=du(this,2),z=du(this,2),B[0].h(0,0),B[1].h(0,K),z[0].h(E,0),z[1].h(E,K)}else{var Da=Ga();K=gu(this,a,Ca,B,z,E,K,Da);Ia=K.x;B=Da[0];z=Da[1];E=K.width;K=K.height;Ja(Da);O<cb.width&&0>Ia&&(hu(a,-Ia,0,da,pa-1),iu(B,-Ia,0),iu(z,-Ia,0),Ia=0)}Ca.U.h(Ia,S);v=Math.max(v,E);A=Math.max(A,y+(0===Q?0:q)+cb.height);O=E}else{0<n&&0<H&&S+p+cb.height>n&&(S<f&&eu(a,k,0,f-S,da,pa-1),Q++,H=0,da=pa,y=v,S=0,O=135<e?-v-q:v+q);fu(this,Ca,O,0);Ia=0;if(0===H){if(B=Ca.fq,z=Ca.rq,
E=cb.width,K=cb.height,null===B||null===z||e!==Xt(Ca))B=du(this,2),z=du(this,2),B[0].h(0,0),B[1].h(E,0),z[0].h(0,K),z[1].h(E,K)}else Da=Ga(),K=gu(this,a,Ca,B,z,E,K,Da),Ia=K.x,B=Da[0],z=Da[1],E=K.width,K=K.height,Ja(Da),S<cb.height&&0>Ia&&(hu(a,0,-Ia,da,pa-1),iu(B,0,-Ia),iu(z,0,-Ia),Ia=0);Ca.U.h(O,Ia);A=Math.max(A,K);v=Math.max(v,y+(0===Q?0:q)+cb.width);S=K}H++}0<Q&&(b?(A+=Math.max(0,c),O<v&&eu(a,k,v-O,0,da,h-1),0<u&&(l||hu(a,u,0,0,h-1),v+=u)):(v+=Math.max(0,c),S<A&&eu(a,k,0,A-S,da,h-1),0<u&&(l||hu(a,
0,u,0,h-1),A+=u)));u=l=0;switch(k){case ju:b?l+=v/2-a.focus.x-r/2:u+=A/2-a.focus.y-r/2;break;case ku:0<Q?b?l+=v/2-a.focus.x-r/2:u+=A/2-a.focus.y-r/2:b?(ba=g[0].U.x+g[0].fa.x,l+=ba+(g[h-1].U.x+g[h-1].fa.x+2*g[h-1].focus.x-ba)/2-a.focus.x-r/2):(ba=g[0].U.y+g[0].fa.y,u+=ba+(g[h-1].U.y+g[h-1].fa.y+2*g[h-1].focus.y-ba)/2-a.focus.y-r/2);break;case au:b?(l-=r,v+=r):(u-=r,A+=r);break;case Yt:b?(l+=v-a.width+r,v+=r):(u+=A-a.height+r,A+=r);break;case Kt:b?1<h?l+=ba+p/2-a.focus.x:l+=g[0].focus.x-a.focus.x+g[0].fa.x:
1<h?u+=ba+p/2-a.focus.y:u+=g[0].focus.y-a.focus.y+g[0].fa.y;break;case Lt:b?l+=v+p/2-a.focus.x:u+=A+p/2-a.focus.y;break;case Mt:break;default:C("Unhandled alignment value "+k.toString())}for(r=0;r<h;r++)ba=g[r],b?ba.U.h(ba.U.x+ba.fa.x-l,ba.U.y+(135<e?(m?-A:-ba.va.height)+ba.fa.y-c:w+c+ba.fa.y)):ba.U.h(ba.U.x+(135<e?(m?-v:-ba.va.width)+ba.fa.x-c:d+c+ba.fa.x),ba.U.y+ba.fa.y-u);h=g=0;m?b?(v=lu(a,v,l),0>l&&(l=0),135<e&&(u+=A+c),A+=w+c,k===Mt&&(g+=p/2+a.focus.x),h+=w+c):(135<e&&(l+=v+c),v+=d+c,A=mu(a,
A,u),0>u&&(u=0),k===Mt&&(h+=p/2+a.focus.y),g+=d+c):b?(null===a.comments?d>v&&(v=nu(k,d-v,0),g=v.x,h=v.y,v=d,l=0):v=lu(a,v,l),0>l&&(g-=l,l=0),135<e&&(u+=A+c),A=Math.max(Math.max(A,w),A+w+c),h+=w+c):(135<e&&(l+=v+c),v=Math.max(Math.max(v,d),v+d+c),null===a.comments?w>A&&(A=nu(k,0,w-A),g=A.x,h=A.y,A=w,u=0):A=mu(a,A,u),0>u&&(h-=u,u=0),g+=d+c);if(0<Q)e=du(this,4),Q=du(this,4),b?(e[2].h(0,w+c),e[3].h(e[2].x,A),Q[2].h(v,e[2].y),Q[3].h(Q[2].x,e[3].y)):(e[2].h(d+c,0),e[3].h(v,e[2].y),Q[2].h(e[2].x,A),Q[3].h(e[3].x,
Q[2].y));else{e=du(this,B.length+2);Q=du(this,z.length+2);for(k=0;k<B.length;k++)m=B[k],e[k+2].h(m.x+g,m.y+h);for(k=0;k<z.length;k++)m=z[k],Q[k+2].h(m.x+g,m.y+h)}b?(e[0].h(l,0),e[1].h(e[0].x,w),e[2].y<e[1].y&&(e[2].x>e[0].x?e[2].assign(e[1]):e[1].assign(e[2])),e[3].y<e[2].y&&(e[3].x>e[0].x?e[3].assign(e[2]):e[2].assign(e[3])),Q[0].h(l+d,0),Q[1].h(Q[0].x,w),Q[2].y<Q[1].y&&(Q[2].x<Q[0].x?Q[2].assign(Q[1]):Q[1].assign(Q[2])),Q[3].y<Q[2].y&&(Q[3].x<Q[0].x?Q[3].assign(Q[2]):Q[2].assign(Q[3])),e[2].y-=
c/2,Q[2].y-=c/2):(e[0].h(0,u),e[1].h(d,e[0].y),e[2].x<e[1].x&&(e[2].y>e[0].y?e[2].assign(e[1]):e[1].assign(e[2])),e[3].x<e[2].x&&(e[3].y>e[0].y?e[3].assign(e[2]):e[2].assign(e[3])),Q[0].h(0,u+w),Q[1].h(d,Q[0].y),Q[2].x<Q[1].x&&(Q[2].y<Q[0].y?Q[2].assign(Q[1]):Q[1].assign(Q[2])),Q[3].x<Q[2].x&&(Q[3].y<Q[0].y?Q[3].assign(Q[2]):Q[2].assign(Q[3])),e[2].x-=c/2,Q[2].x-=c/2);ou(this,B);ou(this,z);a.fq=e;a.rq=Q;a.fa.h(l,u);a.va.h(v,A)}break;default:C("Unhandled compaction value "+a.compaction.toString())}}};
function Qt(a,b){if(0===b.childrenCount){var c=!1,d=0;null!==b.parent&&(d=b.parent.angle,c=b.parent.alignment,c=Jt(c));var e=Ot(b);b.U.h(0,0);b.va.h(b.width,b.height);null===b.parent||null===b.comments||(180!==d&&270!==d||c)&&!e?b.fa.h(0,0):180===d&&!c||(90===d||270===d)&&e?b.fa.h(b.width-2*b.focus.x,0):b.fa.h(0,b.height-2*b.focus.y)}else{d=Xt(b);c=90===d||270===d;var f=0;e=b.children;for(var g=e.length,h=0;h<g;h++){var k=e[h];f=Math.max(f,c?k.va.width:k.va.height)}var l=b.alignment,m=l===au,n=l===
Yt;h=Jt(l);var p=Math.max(0,b.breadthLimit);k=Zt(b);var r=b.nodeSpacing,q=$t(b),u=m||n?0:q/2,w=b.rowSpacing,v=0;if(m||n||b.rm||b.sm&&1===b.maxGenerationCount)v=Math.max(0,b.rowIndent);m=b.width;var A=b.height,y=0,B=0,z=0,E=0,K=0,O=0,S=0,Q=0,H=0;h&&!Nt(l)&&135<d&&e.reverse();if(Nt(l))if(1<g)for(var da=0;da<g;da++){var ba=e[da],pa=ba.va;0===da%2&&da!==g-1&&(H=Math.max(H,(c?pa.width:pa.height)+pu(ba)-r))}else 1===g&&(H=c?e[0].va.width:e[0].va.height);if(h)switch(l){case Kt:case At:B=135>d?bu(b,e,H,y,
B):cu(b,e,H,y,B);H=B.x;y=B.width;B=B.height;break;case Lt:for(a=0;a<g;a++)p=e[a],u=p.va,z=0===S?0:w,c?(p.U.h(f-u.width,K+z),y=Math.max(y,u.width),B=Math.max(B,K+z+u.height),K+=z+u.height):(p.U.h(E+z,f-u.height),y=Math.max(y,E+z+u.width),B=Math.max(B,u.height),E+=z+u.width),S++;break;case Mt:for(f=0;f<g;f++)a=e[f],p=a.va,u=0===S?0:w,c?(a.U.h(r/2+b.focus.x,K+u),y=Math.max(y,p.width),B=Math.max(B,K+u+p.height),K+=u+p.height):(a.U.h(E+u,r/2+b.focus.y),y=Math.max(y,E+u+p.width),B=Math.max(B,p.height),
E+=u+p.width),S++}else for(da=0;da<g;da++){ba=e[da];pa=ba.va;if(c){0<p&&0<S&&E+r+pa.width>p&&(E<f&&eu(b,l,f-E,0,Q,da-1),O++,S=0,Q=da,z=B,E=0,K=135<d?-B-w:B+w);var Ca=0===S?u:r;fu(a,ba,0,K);ba.U.h(E+Ca,K);y=Math.max(y,E+Ca+pa.width);B=Math.max(B,z+(0===O?0:w)+pa.height);E+=Ca+pa.width}else 0<p&&0<S&&K+r+pa.height>p&&(K<f&&eu(b,l,0,f-K,Q,da-1),O++,S=0,Q=da,z=y,K=0,E=135<d?-y-w:y+w),Ca=0===S?u:r,fu(a,ba,E,0),ba.U.h(E,K+Ca),B=Math.max(B,K+Ca+pa.height),y=Math.max(y,z+(0===O?0:w)+pa.width),K+=Ca+pa.height;
S++}0<O&&(c?(B+=Math.max(0,k),E<y&&eu(b,l,y-E,0,Q,g-1),0<v&&(n||hu(b,v,0,0,g-1),y+=v)):(y+=Math.max(0,k),K<B&&eu(b,l,0,B-K,Q,g-1),0<v&&(n||hu(b,0,v,0,g-1),B+=v)));v=n=0;switch(l){case ju:c?n+=y/2-b.focus.x-q/2:v+=B/2-b.focus.y-q/2;break;case ku:0<O?c?n+=y/2-b.focus.x-q/2:v+=B/2-b.focus.y-q/2:c?(l=e[0].U.x+e[0].fa.x,n+=l+(e[g-1].U.x+e[g-1].fa.x+2*e[g-1].focus.x-l)/2-b.focus.x-q/2):(l=e[0].U.y+e[0].fa.y,v+=l+(e[g-1].U.y+e[g-1].fa.y+2*e[g-1].focus.y-l)/2-b.focus.y-q/2);break;case au:c?(n-=q,y+=q):(v-=
q,B+=q);break;case Yt:c?(n+=y-b.width+q,y+=q):(v+=B-b.height+q,B+=q);break;case Kt:case At:c?1<g?n+=H+r/2-b.focus.x:n+=e[0].focus.x-b.focus.x+e[0].fa.x:1<g?v+=H+r/2-b.focus.y:v+=e[0].focus.y-b.focus.y+e[0].fa.y;break;case Lt:c?n+=y+r/2-b.focus.x:v+=B+r/2-b.focus.y;break;case Mt:break;default:C("Unhandled alignment value "+l.toString())}for(q=0;q<g;q++)l=e[q],c?l.U.h(l.U.x+l.fa.x-n,l.U.y+(135<d?(h?-B:-l.va.height)+l.fa.y-k:A+k+l.fa.y)):l.U.h(l.U.x+(135<d?(h?-y:-l.va.width)+l.fa.x-k:m+k+l.fa.x),l.U.y+
l.fa.y-v);c?(y=lu(b,y,n),0>n&&(n=0),135<d&&(v+=B+k),B=Math.max(Math.max(B,A),B+A+k)):(135<d&&(n+=y+k),y=Math.max(Math.max(y,m),y+m+k),B=mu(b,B,v),0>v&&(v=0));b.fa.h(n,v);b.va.h(y,B)}}
function bu(a,b,c,d,e){var f=b.length;if(0===f)return new M(c,0,d,e);if(1===f)return a=b[0],d=a.va.width,e=a.va.height,new M(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=90===Xt(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var r=b[p],q=r.va,u=0===l?0:h;if(k){var w=pu(r)-g;r.U.h(c-(q.width+w),n+u);d=Math.max(d,q.width+w);e=Math.max(e,n+u+q.height);n+=u+q.height}else w=pu(r)-g,r.U.h(m+u,c-(q.height+w)),e=Math.max(e,q.height+w),d=Math.max(d,m+u+q.width),m+=u+q.width;l++}l=0;r=m;p=n;k?
(m=c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];w=u.va;var v=0===l?0:h;if(k){var A=pu(u)-g;u.U.h(m+A,n+v);d=Math.max(d,m+w.width+A);e=Math.max(e,n+v+w.height);n+=v+w.height}else A=pu(u)-g,u.U.h(m+v,n+A),d=Math.max(d,m+v+w.width),e=Math.max(e,n+w.height+A),m+=v+w.width;l++}1<f&&1===f%2&&(b=b[f-1],f=b.va,h=null===b.parent?0:b.parent.rowSpacing,k?(b.U.h(c+g/2-b.focus.x-b.fa.x,e+h),k=c+g/2-b.focus.x-b.fa.x,d=Math.max(d,k+f.width),0>k&&(d-=k),e=Math.max(e,Math.max(p,n)+h+f.height),0>b.U.x&&
(c=qu(a,b.U.x,!1,c,g))):(b.U.h(d+h,c+g/2-b.focus.y-b.fa.y),d=Math.max(d,Math.max(r,m)+h+f.width),n=c+g/2-b.focus.y-b.fa.y,e=Math.max(e,n+f.height),0>n&&(e-=n),0>b.U.y&&(c=qu(a,b.U.y,!0,c,g))));return new M(c,0,d,e)}
function cu(a,b,c,d,e){var f=b.length;if(0===f)return new M(c,0,d,e);if(1===f)return b=b[0],d=b.va.width,e=b.va.height,new M(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=270===Xt(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var r=b[p],q=r.va,u=0===l?0:h;if(k){var w=pu(r)-g;n-=u+q.height;r.U.h(c-(q.width+w),n);d=Math.max(d,q.width+w);e=Math.max(e,Math.abs(n))}else w=pu(r)-g,m-=u+q.width,r.U.h(m,c-(q.height+w)),e=Math.max(e,q.height+w),d=Math.max(d,Math.abs(m));l++}l=0;r=m;p=n;k?(m=
c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];w=u.va;var v=0===l?0:h;if(k){var A=pu(u)-g;n-=v+w.height;u.U.h(m+A,n);d=Math.max(d,m+w.width+A);e=Math.max(e,Math.abs(n))}else A=pu(u)-g,m-=v+w.width,u.U.h(m,n+A),e=Math.max(e,n+w.height+A),d=Math.max(d,Math.abs(m));l++}1<f&&1===f%2&&(h=b[f-1],l=h.va,q=null===h.parent?0:h.parent.rowSpacing,k?(h.U.h(c+g/2-h.focus.x-h.fa.x,-e-l.height-q),m=c+g/2-h.focus.x-h.fa.x,d=Math.max(d,m+l.width),0>m&&(d-=m),e=Math.max(e,Math.abs(Math.min(p,n))+q+l.height),
0>h.U.x&&(c=qu(a,h.U.x,!1,c,g))):(h.U.h(-d-l.width-q,c+g/2-h.focus.y-h.fa.y),d=Math.max(d,Math.abs(Math.min(r,m))+q+l.width),n=c+g/2-h.focus.y-h.fa.y,e=Math.max(e,n+l.height),0>n&&(e-=n),0>h.U.y&&(c=qu(a,h.U.y,!0,c,g))));for(a=0;a<f;a++)g=b[a],k?g.U.h(g.U.x,g.U.y+e):g.U.h(g.U.x+d,g.U.y);return new M(c,0,d,e)}function pu(a){return null===a.parent?0:a.parent.nodeSpacing}
function qu(a,b,c,d,e){a=a.children;for(var f=a.length,g=0;g<f;g++)c?a[g].U.h(a[g].U.x,a[g].U.y-b):a[g].U.h(a[g].U.x-b,a[g].U.y);b=a[f-1];return Math.max(d,c?b.fa.y+b.focus.y-e/2:b.fa.x+b.focus.x-e/2)}
function lu(a,b,c){switch(a.alignment){case ku:case ju:return c+a.width>b&&(b=c+a.width),0>c&&(b-=c),b;case au:return a.width>b?a.width:b;case Yt:return 2*a.focus.x>b?a.width:b+a.width-2*a.focus.x;case Kt:case At:return Math.max(a.width,Math.max(b,c+a.width)-Math.min(0,c));case Lt:return a.width-a.focus.x+a.nodeSpacing/2+b;case Mt:return Math.max(a.width,a.focus.x+a.nodeSpacing/2+b);default:return b}}
function mu(a,b,c){switch(a.alignment){case ku:case ju:return c+a.height>b&&(b=c+a.height),0>c&&(b-=c),b;case au:return a.height>b?a.height:b;case Yt:return 2*a.focus.y>b?a.height:b+a.height-2*a.focus.y;case Kt:case At:return Math.max(a.height,Math.max(b,c+a.height)-Math.min(0,c));case Lt:return a.height-a.focus.y+a.nodeSpacing/2+b;case Mt:return Math.max(a.height,a.focus.y+a.nodeSpacing/2+b);default:return b}}
function nu(a,b,c){switch(a){case ju:b/=2;c/=2;break;case ku:b/=2;c/=2;break;case au:c=b=0;break;case Yt:break;default:C("Unhandled alignment value "+a.toString())}return new J(b,c)}function eu(a,b,c,d,e,f){b=nu(b,c,d);hu(a,b.x,b.y,e,f)}function hu(a,b,c,d,e){if(0!==b||0!==c)for(a=a.children;d<=e;d++){var f=a[d].U;f.x+=b;f.y+=c}}
function fu(a,b,c,d){var e=b.parent;switch(a.md){case jt:for(a=b.sourceEdges;a.next();)b=a.value,b.fromVertex===e&&b.relativePoint.h(c,d);break;case qt:for(a=b.destinationEdges;a.next();)b=a.value,b.toVertex===e&&b.relativePoint.h(c,d);break;default:C("Unhandled path value "+a.md.toString())}}function iu(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];e.x+=b;e.y+=c}}
function gu(a,b,c,d,e,f,g,h){var k=Xt(b),l=90===k||270===k,m=b.nodeSpacing;b=d;var n=e;d=f;var p=g,r=c.fq,q=c.rq;g=c.va;var u=l?Math.max(p,g.height):Math.max(d,g.width);if(null===r||k!==Xt(c))r=du(a,2),q=du(a,2),l?(r[0].h(0,0),r[1].h(0,g.height),q[0].h(g.width,0),q[1].h(q[0].x,r[1].y)):(r[0].h(0,0),r[1].h(g.width,0),q[0].h(0,g.height),q[1].h(r[1].x,q[0].y));if(l){p=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=0;c<n.length&&e<r.length;){f=n[c];var w=r[e];k=w.x;l=w.y;k+=d;var v=
f;c+1<n.length&&(v=n[c+1]);var A=w;w=A.x;A=A.y;e+1<r.length&&(A=r[e+1],w=A.x,A=A.y,w+=d);var y=p;f.y===l?y=k-f.x:f.y>l&&f.y<A?y=k+(f.y-l)/(A-l)*(w-k)-f.x:l>f.y&&l<v.y&&(y=k-(f.x+(l-f.y)/(v.y-f.y)*(v.x-f.x)));y<p&&(p=y);v.y<=f.y?c++:A<=l?e++:(v.y<=A&&c++,A<=v.y&&e++)}p=d-p;p+=m;c=r;e=p;if(null===b||2>b.length||null===c||2>c.length)d=null;else{m=du(a,b.length+c.length);for(d=f=k=0;f<c.length&&c[f].y<b[0].y;)l=c[f++],m[d++].h(l.x+e,l.y);for(;k<b.length;)l=b[k++],m[d++].h(l.x,l.y);for(k=b[b.length-1].y;f<
c.length&&c[f].y<=k;)f++;for(;f<c.length&&c[f].y>k;)l=c[f++],m[d++].h(l.x+e,l.y);c=du(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);ou(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=du(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].y<f[0].y;)v=n[c++],m[e++].h(v.x,v.y);for(;l<f.length;)v=f[l++],m[e++].h(v.x+k,v.y);for(f=f[f.length-1].y;c<n.length&&n[c].y<=f;)c++;for(;c<n.length&&n[c].y>f;)k=n[c++],m[e++].h(k.x,k.y);f=du(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);ou(a,m);e=f}f=
Math.max(0,p)+g.width;g=u;ou(a,b);ou(a,r);ou(a,n);ou(a,q);h[0]=d;h[1]=e;return new M(p,0,f,g)}d=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=0;c<n.length&&e<r.length;)f=n[c],w=r[e],k=w.x,l=w.y,l+=p,v=f,c+1<n.length&&(v=n[c+1]),A=w,w=A.x,A=A.y,e+1<r.length&&(A=r[e+1],w=A.x,A=A.y,A+=p),y=d,f.x===k?y=l-f.y:f.x>k&&f.x<w?y=l+(f.x-k)/(w-k)*(A-l)-f.y:k>f.x&&k<v.x&&(y=l-(f.y+(k-f.x)/(v.x-f.x)*(v.y-f.y))),y<d&&(d=y),v.x<=f.x?c++:w<=k?e++:(v.x<=w&&c++,w<=v.x&&e++);p-=d;p+=m;c=r;e=p;if(null===
b||2>b.length||null===c||2>c.length)d=null;else{m=du(a,b.length+c.length);for(d=f=k=0;f<c.length&&c[f].x<b[0].x;)l=c[f++],m[d++].h(l.x,l.y+e);for(;k<b.length;)l=b[k++],m[d++].h(l.x,l.y);for(k=b[b.length-1].x;f<c.length&&c[f].x<=k;)f++;for(;f<c.length&&c[f].x>k;)l=c[f++],m[d++].h(l.x,l.y+e);c=du(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);ou(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=du(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].x<f[0].x;)v=n[c++],m[e++].h(v.x,v.y);
for(;l<f.length;)v=f[l++],m[e++].h(v.x,v.y+k);for(f=f[f.length-1].x;c<n.length&&n[c].x<=f;)c++;for(;c<n.length&&n[c].x>f;)k=n[c++],m[e++].h(k.x,k.y);f=du(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);ou(a,m);e=f}f=u;g=Math.max(0,p)+g.height;ou(a,b);ou(a,r);ou(a,n);ou(a,q);h[0]=d;h[1]=e;return new M(p,0,f,g)}function du(a,b){a=a.ku[b];if(void 0!==a&&(a=a.pop(),void 0!==a))return a;a=[];for(var c=0;c<b;c++)a[c]=new J;return a}
function ou(a,b){var c=b.length,d=a.ku[c];void 0===d&&(d=[],a.ku[c]=d);d.push(b)}
ht.prototype.arrangeTrees=function(){if(this.Hb===pt)for(var a=this.Kb.iterator;a.next();){var b=a.value;if(b instanceof ot){var c=b.node;if(null!==c){var d=c.position;c=d.x;d=d.y;isFinite(c)||(c=0);isFinite(d)||(d=0);ru(this,b,c,d)}}}else{a=[];for(b=this.Kb.iterator;b.next();)c=b.value,c instanceof ot&&a.push(c);switch(this.sorting){case Ft:break;case Gt:a.reverse();break;case Ht:a.sort(this.comparer);break;case It:a.sort(this.comparer);a.reverse();break;default:C("Unhandled sorting value "+this.sorting.toString())}c=
this.arrangementOrigin;b=c.x;c=c.y;for(d=0;d<a.length;d++){var e=a[d];ru(this,e,b+e.fa.x,c+e.fa.y);switch(this.Hb){case mt:c+=e.va.height+this.Qd.height;break;case su:b+=e.va.width+this.Qd.width;break;default:C("Unhandled arrangement value "+this.Hb.toString())}}}};function ru(a,b,c,d){if(null!==b){b.x=c;b.y=d;b=b.children;for(var e=b.length,f=0;f<e;f++){var g=b[f];ru(a,g,c+g.U.x,d+g.U.y)}}}ht.prototype.commitLayout=function(){this.Iv();this.commitNodes();this.Bu();this.isRouting&&this.commitLinks()};
ht.prototype.commitNodes=function(){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();for(a.reset();a.next();)this.layoutComments(a.value)};
ht.prototype.Bu=function(){if(this.layerStyle===xt){for(var a=this.Aw,b=[],c=null,d=this.network.vertexes.iterator;d.next();){var e=d.value;null===c?c=e.bounds.copy():c.Rc(e.bounds);var f=b[e.level];void 0===f?f=Zt(e):f=Math.max(f,Zt(e));b[e.level]=f}for(d=0;d<b.length;d++)void 0===b[d]&&(b[d]=0);90===this.angle||270===this.angle?(c.Kc(this.nodeSpacing/2,this.layerSpacing),d=new J(-this.nodeSpacing/2,-this.layerSpacing/2)):(c.Kc(this.layerSpacing,this.nodeSpacing/2),d=new J(-this.layerSpacing/2,-this.nodeSpacing/
2));e=[];c=90===this.angle||270===this.angle?c.width:c.height;f=0;if(180===this.angle||270===this.angle)for(var g=0;g<a.length;g++)f+=a[g]+b[g];for(g=0;g<a.length;g++){var h=a[g]+b[g];270===this.angle?(f-=h,e.push(new M(0,f,c,h))):90===this.angle?(e.push(new M(0,f,c,h)),f+=h):180===this.angle?(f-=h,e.push(new M(f,0,h,c))):(e.push(new M(f,0,h,c)),f+=h)}this.commitLayers(e,d)}};ht.prototype.commitLayers=function(){};ht.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};
ht.prototype.Iv=function(){for(var a=this.Kb.iterator;a.next();){var b=a.value;b instanceof ot&&tu(this,b)}};function tu(a,b){if(null!==b){a.setPortSpots(b);b=b.children;for(var c=b.length,d=0;d<c;d++)tu(a,b[d])}}
ht.prototype.setPortSpots=function(a){var b=a.alignment;if(Jt(b)){var c=this.md===jt,d=Xt(a);switch(d){case 0:var e=bd;break;case 90:e=cd;break;case 180:e=ad;break;default:e=$c}var f=a.children,g=f.length;switch(b){case Kt:case At:for(b=0;b<g;b++){var h=f[b];h=(c?h.sourceEdges:h.destinationEdges).first();if(null!==h&&(h=h.link,null!==h)){var k=90===d||270===d?ad:$c;if(1===g||b===g-1&&1===g%2)switch(d){case 0:k=ad;break;case 90:k=$c;break;case 180:k=bd;break;default:k=cd}else 0===b%2&&(k=90===d||270===
d?bd:cd);c?(a.setsPortSpot&&(h.fromSpot=e),a.setsChildPortSpot&&(h.toSpot=k)):(a.setsPortSpot&&(h.fromSpot=k),a.setsChildPortSpot&&(h.toSpot=e))}}break;case Lt:d=90===d||270===d?bd:cd;for(f=c?a.destinationEdges:a.sourceEdges;f.next();)g=f.value.link,null!==g&&(c?(a.setsPortSpot&&(g.fromSpot=e),a.setsChildPortSpot&&(g.toSpot=d)):(a.setsPortSpot&&(g.fromSpot=d),a.setsChildPortSpot&&(g.toSpot=e)));break;case Mt:for(d=90===d||270===d?ad:$c,f=c?a.destinationEdges:a.sourceEdges;f.next();)g=f.value.link,
null!==g&&(c?(a.setsPortSpot&&(g.fromSpot=e),a.setsChildPortSpot&&(g.toSpot=d)):(a.setsPortSpot&&(g.fromSpot=d),a.setsChildPortSpot&&(g.toSpot=e)))}}else if(c=Xt(a),this.md===jt)for(e=a.destinationEdges;e.next();){if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Mb())switch(c){case 0:d.fromSpot=bd;break;case 90:d.fromSpot=cd;break;case 180:d.fromSpot=ad;break;default:d.fromSpot=$c}else d.fromSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Mb())switch(c){case 0:d.toSpot=ad;break;
case 90:d.toSpot=$c;break;case 180:d.toSpot=bd;break;default:d.toSpot=cd}else d.toSpot=a.childPortSpot}}else for(e=a.sourceEdges;e.next();)if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Mb())switch(c){case 0:d.toSpot=bd;break;case 90:d.toSpot=cd;break;case 180:d.toSpot=ad;break;default:d.toSpot=$c}else d.toSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Mb())switch(c){case 0:d.fromSpot=ad;break;case 90:d.fromSpot=$c;break;case 180:d.fromSpot=bd;break;default:d.fromSpot=cd}else d.fromSpot=
a.childPortSpot}};function Xt(a){a=a.angle;return 45>=a?0:135>=a?90:225>=a?180:315>=a?270:0}function Zt(a){var b=Xt(a);b=90===b||270===b;var c=a.layerSpacing;if(0<a.layerSpacingParentOverlap){var d=Math.min(1,a.layerSpacingParentOverlap);c-=b?a.height*d:a.width*d}c<(b?-a.height:-a.width)&&(c=b?-a.height:-a.width);return c}function $t(a){var b=Xt(a),c=a.nodeIndent;if(0<a.nodeIndentPastParent){var d=Math.min(1,a.nodeIndentPastParent);c+=90===b||270===b?a.width*d:a.height*d}return c=Math.max(0,c)}
na.Object.defineProperties(ht.prototype,{roots:{get:function(){return this.Kb},set:function(a){this.Kb!==a&&(this.Kb=a,this.B())}},path:{get:function(){return this.Mo},set:function(a){this.Mo!==a&&(this.Mo=a,this.B())}},treeStyle:{get:function(){return this.Ep},set:function(a){this.Hb===a||a!==kt&&a!==Dt&&a!==Et&&a!==Ct||(this.Ep=a,this.B())}},layerStyle:{get:function(){return this.tr},
set:function(a){this.Hb===a||a!==lt&&a!==yt&&a!==xt||(this.tr=a,this.B())}},comments:{get:function(){return this.kd},set:function(a){this.kd!==a&&(this.kd=a,this.B())}},arrangement:{get:function(){return this.Hb},set:function(a){this.Hb===a||a!==mt&&a!==su&&a!==pt||(this.Hb=a,this.B())}},arrangementSpacing:{get:function(){return this.Qd},set:function(a){this.Qd.A(a)||(this.Qd.assign(a),this.B())}},rootDefaults:{
get:function(){return this.V},set:function(a){this.V!==a&&(this.V=a,this.B())}},alternateDefaults:{get:function(){return this.W},set:function(a){this.W!==a&&(this.W=a,this.B())}},sorting:{get:function(){return this.V.sorting},set:function(a){this.V.sorting===a||a!==Ft&&a!==Gt&&a!==Ht&&!It||(this.V.sorting=a,this.B())}},comparer:{get:function(){return this.V.comparer},set:function(a){this.V.comparer!==
a&&(this.V.comparer=a,this.B())}},angle:{get:function(){return this.V.angle},set:function(a){this.V.angle!==a&&(0===a||90===a||180===a||270===a?(this.V.angle=a,this.B()):C("TreeLayout.angle must be 0, 90, 180, or 270"))}},alignment:{get:function(){return this.V.alignment},set:function(a){this.V.alignment!==a&&(this.V.alignment=a,this.B())}},nodeIndent:{get:function(){return this.V.nodeIndent},set:function(a){this.V.nodeIndent!==
a&&0<=a&&(this.V.nodeIndent=a,this.B())}},nodeIndentPastParent:{get:function(){return this.V.nodeIndentPastParent},set:function(a){this.V.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.V.nodeIndentPastParent=a,this.B())}},nodeSpacing:{get:function(){return this.V.nodeSpacing},set:function(a){this.V.nodeSpacing!==a&&(this.V.nodeSpacing=a,this.B())}},layerSpacing:{get:function(){return this.V.layerSpacing},set:function(a){this.V.layerSpacing!==
a&&(this.V.layerSpacing=a,this.B())}},layerSpacingParentOverlap:{get:function(){return this.V.layerSpacingParentOverlap},set:function(a){this.V.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.V.layerSpacingParentOverlap=a,this.B())}},compaction:{get:function(){return this.V.compaction},set:function(a){this.V.compaction===a||a!==Pt&&a!==Wt||(this.V.compaction=a,this.B())}},breadthLimit:{get:function(){return this.V.breadthLimit},
set:function(a){this.V.breadthLimit!==a&&0<=a&&(this.V.breadthLimit=a,this.B())}},rowSpacing:{get:function(){return this.V.rowSpacing},set:function(a){this.V.rowSpacing!==a&&(this.V.rowSpacing=a,this.B())}},rowIndent:{get:function(){return this.V.rowIndent},set:function(a){this.V.rowIndent!==a&&0<=a&&(this.V.rowIndent=a,this.B())}},commentSpacing:{get:function(){return this.V.commentSpacing},set:function(a){this.V.commentSpacing!==
a&&(this.V.commentSpacing=a,this.B())}},commentMargin:{get:function(){return this.V.commentMargin},set:function(a){this.V.commentMargin!==a&&(this.V.commentMargin=a,this.B())}},setsPortSpot:{get:function(){return this.V.setsPortSpot},set:function(a){this.V.setsPortSpot!==a&&(this.V.setsPortSpot=a,this.B())}},portSpot:{get:function(){return this.V.portSpot},set:function(a){this.V.portSpot.A(a)||(this.V.portSpot=
a,this.B())}},setsChildPortSpot:{get:function(){return this.V.setsChildPortSpot},set:function(a){this.V.setsChildPortSpot!==a&&(this.V.setsChildPortSpot=a,this.B())}},childPortSpot:{get:function(){return this.V.childPortSpot},set:function(a){this.V.childPortSpot.A(a)||(this.V.childPortSpot=a,this.B())}},alternateSorting:{get:function(){return this.W.sorting},set:function(a){this.W.sorting===a||a!==Ft&&a!==Gt&&
a!==Ht&&!It||(this.W.sorting=a,this.B())}},alternateComparer:{get:function(){return this.W.comparer},set:function(a){this.W.comparer!==a&&(this.W.comparer=a,this.B())}},alternateAngle:{get:function(){return this.W.angle},set:function(a){this.W.angle===a||0!==a&&90!==a&&180!==a&&270!==a||(this.W.angle=a,this.B())}},alternateAlignment:{get:function(){return this.W.alignment},set:function(a){this.W.alignment!==
a&&(this.W.alignment=a,this.B())}},alternateNodeIndent:{get:function(){return this.W.nodeIndent},set:function(a){this.W.nodeIndent!==a&&0<=a&&(this.W.nodeIndent=a,this.B())}},alternateNodeIndentPastParent:{get:function(){return this.W.nodeIndentPastParent},set:function(a){this.W.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.W.nodeIndentPastParent=a,this.B())}},alternateNodeSpacing:{get:function(){return this.W.nodeSpacing},
set:function(a){this.W.nodeSpacing!==a&&(this.W.nodeSpacing=a,this.B())}},alternateLayerSpacing:{get:function(){return this.W.layerSpacing},set:function(a){this.W.layerSpacing!==a&&(this.W.layerSpacing=a,this.B())}},alternateLayerSpacingParentOverlap:{get:function(){return this.W.layerSpacingParentOverlap},set:function(a){this.W.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.W.layerSpacingParentOverlap=a,this.B())}},alternateCompaction:{
get:function(){return this.W.compaction},set:function(a){this.W.compaction===a||a!==Pt&&a!==Wt||(this.W.compaction=a,this.B())}},alternateBreadthLimit:{get:function(){return this.W.breadthLimit},set:function(a){this.W.breadthLimit!==a&&0<=a&&(this.W.breadthLimit=a,this.B())}},alternateRowSpacing:{get:function(){return this.W.rowSpacing},set:function(a){this.W.rowSpacing!==a&&(this.W.rowSpacing=a,this.B())}},alternateRowIndent:{
get:function(){return this.W.rowIndent},set:function(a){this.W.rowIndent!==a&&0<=a&&(this.W.rowIndent=a,this.B())}},alternateCommentSpacing:{get:function(){return this.W.commentSpacing},set:function(a){this.W.commentSpacing!==a&&(this.W.commentSpacing=a,this.B())}},alternateCommentMargin:{get:function(){return this.W.commentMargin},set:function(a){this.W.commentMargin!==a&&(this.W.commentMargin=a,this.B())}},alternateSetsPortSpot:{
get:function(){return this.W.setsPortSpot},set:function(a){this.W.setsPortSpot!==a&&(this.W.setsPortSpot=a,this.B())}},alternatePortSpot:{get:function(){return this.W.portSpot},set:function(a){this.W.portSpot.A(a)||(this.W.portSpot=a,this.B())}},alternateSetsChildPortSpot:{get:function(){return this.W.setsChildPortSpot},set:function(a){this.W.setsChildPortSpot!==a&&(this.W.setsChildPortSpot=a,this.B())}},alternateChildPortSpot:{
get:function(){return this.W.childPortSpot},set:function(a){this.W.childPortSpot.A(a)||(this.W.childPortSpot=a,this.B())}}});
var it=new D(ht,"PathDefault",-1),jt=new D(ht,"PathDestination",0),qt=new D(ht,"PathSource",1),Ft=new D(ht,"SortingForwards",10),Gt=new D(ht,"SortingReverse",11),Ht=new D(ht,"SortingAscending",12),It=new D(ht,"SortingDescending",13),ju=new D(ht,"AlignmentCenterSubtrees",20),ku=new D(ht,"AlignmentCenterChildren",21),au=new D(ht,"AlignmentStart",22),Yt=new D(ht,"AlignmentEnd",23),Kt=new D(ht,"AlignmentBus",24),At=new D(ht,"AlignmentBusBranching",25),Lt=new D(ht,"AlignmentTopLeftBus",26),Mt=new D(ht,
"AlignmentBottomRightBus",27),Pt=new D(ht,"CompactionNone",30),Wt=new D(ht,"CompactionBlock",31),kt=new D(ht,"StyleLayered",40),Et=new D(ht,"StyleLastParents",41),Dt=new D(ht,"StyleAlternating",42),Ct=new D(ht,"StyleRootOnly",43),mt=new D(ht,"ArrangementVertical",50),su=new D(ht,"ArrangementHorizontal",51),pt=new D(ht,"ArrangementFixedRoots",52),lt=new D(ht,"LayerIndividual",60),yt=new D(ht,"LayerSiblings",61),xt=new D(ht,"LayerUniform",62);ht.className="TreeLayout";ht.PathDefault=it;
ht.PathDestination=jt;ht.PathSource=qt;ht.SortingForwards=Ft;ht.SortingReverse=Gt;ht.SortingAscending=Ht;ht.SortingDescending=It;ht.AlignmentCenterSubtrees=ju;ht.AlignmentCenterChildren=ku;ht.AlignmentStart=au;ht.AlignmentEnd=Yt;ht.AlignmentBus=Kt;ht.AlignmentBusBranching=At;ht.AlignmentTopLeftBus=Lt;ht.AlignmentBottomRightBus=Mt;ht.CompactionNone=Pt;ht.CompactionBlock=Wt;ht.StyleLayered=kt;ht.StyleLastParents=Et;ht.StyleAlternating=Dt;ht.StyleRootOnly=Ct;ht.ArrangementVertical=mt;
ht.ArrangementHorizontal=su;ht.ArrangementFixedRoots=pt;ht.LayerIndividual=lt;ht.LayerSiblings=yt;ht.LayerUniform=xt;function nt(a){Op.call(this,a)}ma(nt,Op);nt.prototype.createVertex=function(){return new ot(this)};nt.prototype.createEdge=function(){return new uu(this)};nt.className="TreeNetwork";
function ot(a){bq.call(this,a);this.wa=!1;this.Gb=null;this.D=[];this.Qb=this.Ma=this.L=this.Ba=0;this.kd=null;this.U=new J(0,0);this.va=new Fb(0,0);this.fa=new J(0,0);this.sm=this.rm=this.MA=!1;this.rq=this.fq=null;this.ad=Ft;this.Tc=iq;this.zb=0;this.yb=ku;this.Cr=this.Br=0;this.Dr=20;this.be=50;this.sr=0;this.Lq=Wt;this.Eq=0;this.Mr=25;this.Kq=this.Lr=10;this.Jq=20;this.Qr=!0;this.Ir=Tc;this.Pr=!0;this.Hq=Tc}ma(ot,bq);
ot.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.ad=a.sorting,this.Tc=a.comparer,this.zb=a.angle,this.yb=a.alignment,this.Br=a.nodeIndent,this.Cr=a.nodeIndentPastParent,this.Dr=a.nodeSpacing,this.be=a.layerSpacing,this.sr=a.layerSpacingParentOverlap,this.Lq=a.compaction,this.Eq=a.breadthLimit,this.Mr=a.rowSpacing,this.Lr=a.rowIndent,this.Kq=a.commentSpacing,this.Jq=a.commentMargin,this.Qr=a.setsPortSpot,this.Ir=a.portSpot,this.Pr=a.setsChildPortSpot,this.Hq=a.childPortSpot)};
na.Object.defineProperties(ot.prototype,{initialized:{get:function(){return this.wa},set:function(a){this.wa!==a&&(this.wa=a)}},parent:{get:function(){return this.Gb},set:function(a){this.Gb!==a&&(this.Gb=a)}},children:{get:function(){return this.D},set:function(a){if(this.D!==a){if(null!==a)for(var b=a.length,c=0;c<b;c++);this.D=a}}},level:{get:function(){return this.Ba},set:function(a){this.Ba!==
a&&(this.Ba=a)}},descendantCount:{get:function(){return this.L},set:function(a){this.L!==a&&(this.L=a)}},maxChildrenCount:{get:function(){return this.Ma},set:function(a){this.Ma!==a&&(this.Ma=a)}},maxGenerationCount:{get:function(){return this.Qb},set:function(a){this.Qb!==a&&(this.Qb=a)}},comments:{get:function(){return this.kd},set:function(a){if(this.kd!==a){if(null!==a)for(var b=
a.length,c=0;c<b;c++);this.kd=a}}},sorting:{get:function(){return this.ad},set:function(a){this.ad!==a&&(this.ad=a)}},comparer:{get:function(){return this.Tc},set:function(a){this.Tc!==a&&(this.Tc=a)}},angle:{get:function(){return this.zb},set:function(a){this.zb!==a&&(this.zb=a)}},alignment:{get:function(){return this.yb},set:function(a){this.yb!==a&&(this.yb=a)}},nodeIndent:{
get:function(){return this.Br},set:function(a){this.Br!==a&&(this.Br=a)}},nodeIndentPastParent:{get:function(){return this.Cr},set:function(a){this.Cr!==a&&(this.Cr=a)}},nodeSpacing:{get:function(){return this.Dr},set:function(a){this.Dr!==a&&(this.Dr=a)}},layerSpacing:{get:function(){return this.be},set:function(a){this.be!==a&&(this.be=a)}},layerSpacingParentOverlap:{
get:function(){return this.sr},set:function(a){this.sr!==a&&(this.sr=a)}},compaction:{get:function(){return this.Lq},set:function(a){this.Lq!==a&&(this.Lq=a)}},breadthLimit:{get:function(){return this.Eq},set:function(a){this.Eq!==a&&(this.Eq=a)}},rowSpacing:{get:function(){return this.Mr},set:function(a){this.Mr!==a&&(this.Mr=a)}},rowIndent:{get:function(){return this.Lr},set:function(a){this.Lr!==
a&&(this.Lr=a)}},commentSpacing:{get:function(){return this.Kq},set:function(a){this.Kq!==a&&(this.Kq=a)}},commentMargin:{get:function(){return this.Jq},set:function(a){this.Jq!==a&&(this.Jq=a)}},setsPortSpot:{get:function(){return this.Qr},set:function(a){this.Qr!==a&&(this.Qr=a)}},portSpot:{get:function(){return this.Ir},set:function(a){this.Ir.A(a)||(this.Ir=a)}},setsChildPortSpot:{
get:function(){return this.Pr},set:function(a){this.Pr!==a&&(this.Pr=a)}},childPortSpot:{get:function(){return this.Hq},set:function(a){this.Hq.A(a)||(this.Hq=a)}},childrenCount:{get:function(){return this.children.length}},relativePosition:{get:function(){return this.U},set:function(a){this.U.set(a)}},subtreeSize:{get:function(){return this.va},set:function(a){this.va.set(a)}},
subtreeOffset:{get:function(){return this.fa},set:function(a){this.fa.set(a)}}});ot.className="TreeVertex";function uu(a){cq.call(this,a);this.Xt=new J(0,0)}ma(uu,cq);
uu.prototype.commit=function(){var a=this.link;if(null!==a&&!a.isAvoiding){var b=this.network.layout,c=null,d=null;switch(b.md){case jt:c=this.fromVertex;d=this.toVertex;break;case qt:c=this.toVertex;d=this.fromVertex;break;default:C("Unhandled path value "+b.md.toString())}if(null!==c&&null!==d)if(b=this.Xt,0!==b.x||0!==b.y||c.MA){d=c.bounds;var e=Xt(c),f=Zt(c),g=c.rowSpacing;a.ug();var h=a.curve===Uf,k=a.isOrthogonal,l;a.Lh();if(k||h){for(l=2;4<a.pointsCount;)a.Av(2);var m=a.i(1);var n=a.i(2)}else{for(l=
1;3<a.pointsCount;)a.Av(1);m=a.i(0);n=a.i(a.pointsCount-1)}var p=a.i(a.pointsCount-1);0===e?(c.alignment===Yt?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-$t(c))))):c.alignment===au?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+$t(c))))):e=c.rm||c.sm&&1===c.maxGenerationCount?d.top-c.fa.y+b.y:d.y+d.height/2+b.y,h?(a.l(l,m.x,e),l++,a.l(l,d.right+f,e),l++,a.l(l,d.right+f+(b.x-g)/3,e),l++,a.l(l,d.right+f+2*(b.x-g)/3,e),l++,a.l(l,d.right+f+(b.x-
g),e),l++,a.l(l,n.x,e)):(k&&(a.l(l,d.right+f/2,m.y),l++),a.l(l,d.right+f/2,e),l++,a.l(l,d.right+f+b.x-(k?g/2:g),e),l++,k&&a.l(l,a.i(l-1).x,n.y))):90===e?(c.alignment===Yt?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-$t(c))))):c.alignment===au?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+$t(c))))):e=c.rm||c.sm&&1===c.maxGenerationCount?d.left-c.fa.x+b.x:d.x+d.width/2+b.x,h?(a.l(l,e,m.y),l++,a.l(l,e,d.bottom+f),l++,a.l(l,e,d.bottom+f+(b.y-g)/
3),l++,a.l(l,e,d.bottom+f+2*(b.y-g)/3),l++,a.l(l,e,d.bottom+f+(b.y-g)),l++,a.l(l,e,n.y)):(k&&(a.l(l,m.x,d.bottom+f/2),l++),a.l(l,e,d.bottom+f/2),l++,a.l(l,e,d.bottom+f+b.y-(k?g/2:g)),l++,k&&a.l(l,n.x,a.i(l-1).y))):180===e?(c.alignment===Yt?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-$t(c))))):c.alignment===au?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+$t(c))))):e=c.rm||c.sm&&1===c.maxGenerationCount?d.top-c.fa.y+b.y:d.y+d.height/2+b.y,h?
(a.l(l,m.x,e),l++,a.l(l,d.left-f,e),l++,a.l(l,d.left-f+(b.x+g)/3,e),l++,a.l(l,d.left-f+2*(b.x+g)/3,e),l++,a.l(l,d.left-f+(b.x+g),e),l++,a.l(l,n.x,e)):(k&&(a.l(l,d.left-f/2,m.y),l++),a.l(l,d.left-f/2,e),l++,a.l(l,d.left-f+b.x+(k?g/2:g),e),l++,k&&a.l(l,a.i(l-1).x,n.y))):270===e?(c.alignment===Yt?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-$t(c))))):c.alignment===au?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+$t(c))))):e=c.rm||c.sm&&1===c.maxGenerationCount?
d.left-c.fa.x+b.x:d.x+d.width/2+b.x,h?(a.l(l,e,m.y),l++,a.l(l,e,d.top-f),l++,a.l(l,e,d.top-f+(b.y+g)/3),l++,a.l(l,e,d.top-f+2*(b.y+g)/3),l++,a.l(l,e,d.top-f+(b.y+g)),l++,a.l(l,e,n.y)):(k&&(a.l(l,m.x,d.top-f/2),l++),a.l(l,e,d.top-f/2),l++,a.l(l,e,d.top-f+b.y+(k?g/2:g)),l++,k&&a.l(l,n.x,a.i(l-1).y))):C("Invalid angle "+e);a.vf()}else a=this.link,f=Xt(c),f!==Xt(d)&&(g=Zt(c),h=c.bounds,c=d.bounds,0===f&&c.left-h.right<g+1||90===f&&c.top-h.bottom<g+1||180===f&&h.left-c.right<g+1||270===f&&h.top-c.bottom<
g+1||(a.ug(),c=a.curve===Uf,b=a.isOrthogonal,d=Jt(this.fromVertex.alignment),a.Lh(),0===f?(f=h.right+g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.M(1,f-20,a.i(1).y),a.l(2,f-20,c),a.l(3,f,c),a.l(4,f+20,c),a.M(5,a.i(5).x,c)):b?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,f,a.i(2).y),a.M(3,f,a.i(3).y)):4===a.pointsCount?a.l(2,f,a.i(2).y):3===a.pointsCount?a.M(1,f,a.i(2).y):2===a.pointsCount&&a.l(1,f,a.i(1).y)):90===f?(f=h.bottom+g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.M(1,a.i(1).x,f-20),a.l(2,c,f-20),
a.l(3,c,f),a.l(4,c,f+20),a.M(5,c,a.i(5).y)):b?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,a.i(2).x,f),a.M(3,a.i(3).x,f)):4===a.pointsCount?a.l(2,a.i(2).x,f):3===a.pointsCount?a.M(1,a.i(2).x,f):2===a.pointsCount&&a.l(1,a.i(1).x,f)):180===f?(f=h.left-g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.M(1,f+20,a.i(1).y),a.l(2,f+20,c),a.l(3,f,c),a.l(4,f-20,c),a.M(5,a.i(5).x,c)):b?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,f,a.i(2).y),a.M(3,f,a.i(3).y)):4===a.pointsCount?a.l(2,f,a.i(2).y):3===a.pointsCount?
a.M(1,f,a.i(2).y):2===a.pointsCount&&a.l(1,f,a.i(1).y)):270===f&&(f=h.top-g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.M(1,a.i(1).x,f+20),a.l(2,c,f+20),a.l(3,c,f),a.l(4,c,f-20),a.M(5,c,a.i(5).y)):b?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,a.i(2).x,f),a.M(3,a.i(3).x,f)):4===a.pointsCount?a.l(2,a.i(2).x,f):3===a.pointsCount?a.M(1,a.i(2).x,f):2===a.pointsCount&&a.l(1,a.i(1).x,f)),a.vf()))}};
na.Object.defineProperties(uu.prototype,{fromVertex:{get:function(){return this.Vc},set:function(a){this.Vc!==a&&(this.Vc=a)}},toVertex:{get:function(){return this.dd},set:function(a){this.dd!==a&&(this.dd=a)}},relativePoint:{get:function(){return this.Xt},set:function(a){this.Xt.set(a)}}});uu.className="TreeEdge";
Pa.prototype.initializeStandardTools=function(){this.Za("Action",new tg,this.mouseDownTools);this.Za("Relinking",new Re,this.mouseDownTools);this.Za("LinkReshaping",new Sf,this.mouseDownTools);this.Za("Rotating",new rg,this.mouseDownTools);this.Za("Resizing",new Zf,this.mouseDownTools);this.Za("Linking",new Lf,this.mouseMoveTools);this.Za("Dragging",new Fe,this.mouseMoveTools);this.Za("DragSelecting",new wg,this.mouseMoveTools);this.Za("Panning",new xg,this.mouseMoveTools);this.Za("ContextMenu",new zg,
this.mouseUpTools);this.Za("TextEditing",new Kg,this.mouseUpTools);this.Za("ClickCreating",new ug,this.mouseUpTools);this.Za("ClickSelecting",new sg,this.mouseUpTools)};kn("Horizontal",new nm);kn("Spot",new pm);kn("Table",new um);kn("Viewbox",new zm);kn("TableRow",new xm);kn("TableColumn",new ym);kn("Graduated",new Jm);kn("Grid",new Am);hi.add("GraphLinksModel",Bq);hi.add("TreeModel",Pq);Up(Wr,null);Up(ks,null);
var vu=x.go,wu={get licenseKey(){return R.licenseKey},set licenseKey(a){R.licenseKey=a},get version(){return R.version},Group:U,EnumValue:D,List:F,Set:G,Map:I,Point:J,Size:Fb,Rect:M,Margin:kc,Spot:N,Geometry:P,PathFigure:$d,PathSegment:ae,InputEvent:ce,DiagramEvent:ee,ChangedEvent:fe,Model:Z,GraphLinksModel:jr,TreeModel:or,Binding:si,Transaction:qe,UndoManager:re,CommandHandler:Kk,Tool:te,DraggingTool:Fe,DraggingInfo:Se,DraggingOptions:Le,LinkingBaseTool:wf,LinkingTool:Lf,RelinkingTool:Re,LinkReshapingTool:Sf,
ResizingTool:Zf,RotatingTool:rg,ClickSelectingTool:sg,ActionTool:tg,ClickCreatingTool:ug,HTMLInfo:De,ContextMenuTool:zg,DragSelectingTool:wg,PanningTool:xg,TextEditingTool:Kg,ToolManager:Pa,Animation:fh,AnimationManager:bh,AnimationTrigger:Vh,Layer:$h,Diagram:R,Palette:Dk,Overview:Gk,Brush:gl,GraphObject:Y,Panel:X,RowColumnDefinition:Ij,Shape:xf,TextBlock:Lg,Picture:Qj,Part:V,Adornment:ye,Node:W,Link:T,Placeholder:mg,Layout:mi,LayoutNetwork:Op,LayoutVertex:bq,LayoutEdge:cq,GridLayout:Fk,PanelLayout:El,
CircularLayout:pr,CircularNetwork:Gr,CircularVertex:Ur,CircularEdge:Vr,ForceDirectedLayout:Wr,ForceDirectedNetwork:Xr,ForceDirectedVertex:is,ForceDirectedEdge:js,LayeredDigraphLayout:ks,LayeredDigraphNetwork:ps,LayeredDigraphVertex:ft,LayeredDigraphEdge:gt,TreeLayout:ht,TreeNetwork:nt,TreeVertex:ot,TreeEdge:uu};"object"===typeof vu&&vu.version&&C("WARNING: a `go` object on the root object is already defined.  "+("Debug"in vu?"debug ":"")+"version: "+vu.version+", replaced with version: "+wu.version);
R.prototype.go=wu;x.go=wu;("undefined"===typeof x||"undefined"===typeof x.module||"object"!==typeof x.module.exports)&&x.define&&"function"===typeof x.define&&x.define.amd&&x.define(wu); 'undefined'!==typeof module&&'object'===typeof module.exports&&(module.exports='undefined'!==typeof global?global.go:self.go); })();



  export default (typeof global !== "undefined") ? global.go : self.go;
  export const go = (typeof global !== "undefined") ? global.go : self.go;
export const Group = go.Group;
export const EnumValue = go.EnumValue;
export const List = go.List;
export const Set = go.Set;
export const Map = go.Map;
export const Point = go.Point;
export const Size = go.Size;
export const Rect = go.Rect;
export const Margin = go.Margin;
export const Spot = go.Spot;
export const Geometry = go.Geometry;
export const PathFigure = go.PathFigure;
export const PathSegment = go.PathSegment;
export const InputEvent = go.InputEvent;
export const DiagramEvent = go.DiagramEvent;
export const ChangedEvent = go.ChangedEvent;
export const Model = go.Model;
export const GraphLinksModel = go.GraphLinksModel;
export const TreeModel = go.TreeModel;
export const Binding = go.Binding;
export const Transaction = go.Transaction;
export const UndoManager = go.UndoManager;
export const CommandHandler = go.CommandHandler;
export const Tool = go.Tool;
export const DraggingTool = go.DraggingTool;
export const DraggingInfo = go.DraggingInfo;
export const LinkingBaseTool = go.LinkingBaseTool;
export const LinkingTool = go.LinkingTool;
export const RelinkingTool = go.RelinkingTool;
export const LinkReshapingTool = go.LinkReshapingTool;
export const ResizingTool = go.ResizingTool;
export const RotatingTool = go.RotatingTool;
export const ClickSelectingTool = go.ClickSelectingTool;
export const ActionTool = go.ActionTool;
export const ClickCreatingTool = go.ClickCreatingTool;
export const HTMLInfo = go.HTMLInfo;
export const ContextMenuTool = go.ContextMenuTool;
export const DragSelectingTool = go.DragSelectingTool;
export const PanningTool = go.PanningTool;
export const TextEditingTool = go.TextEditingTool;
export const ToolManager = go.ToolManager;
export const Animation = go.Animation;
export const AnimationManager = go.AnimationManager;
export const AnimationTrigger = go.AnimationTrigger;
export const Layer = go.Layer;
export const Diagram = go.Diagram;
export const Palette = go.Palette;
export const Overview = go.Overview;
export const Brush = go.Brush;
export const GraphObject = go.GraphObject;
export const Panel = go.Panel;
export const RowColumnDefinition = go.RowColumnDefinition;
export const Shape = go.Shape;
export const TextBlock = go.TextBlock;
export const TextBlockMetrics = go.TextBlockMetrics;
export const Picture = go.Picture;
export const Part = go.Part;
export const Adornment = go.Adornment;
export const Node = go.Node;
export const Link = go.Link;
export const Placeholder = go.Placeholder;
export const Layout = go.Layout;
export const LayoutNetwork = go.LayoutNetwork;
export const LayoutVertex = go.LayoutVertex;
export const LayoutEdge = go.LayoutEdge;
export const GridLayout = go.GridLayout;
export const PanelLayout = go.PanelLayout;
export const CircularLayout = go.CircularLayout;
export const CircularNetwork = go.CircularNetwork;
export const CircularVertex = go.CircularVertex;
export const CircularEdge = go.CircularEdge;
export const ForceDirectedLayout = go.ForceDirectedLayout;
export const ForceDirectedNetwork = go.ForceDirectedNetwork;
export const ForceDirectedVertex = go.ForceDirectedVertex;
export const ForceDirectedEdge = go.ForceDirectedEdge;
export const LayeredDigraphLayout = go.LayeredDigraphLayout;
export const LayeredDigraphNetwork = go.LayeredDigraphNetwork;
export const LayeredDigraphVertex = go.LayeredDigraphVertex;
export const LayeredDigraphEdge = go.LayeredDigraphEdge;
export const TreeLayout = go.TreeLayout;
export const TreeNetwork = go.TreeNetwork;
export const TreeVertex = go.TreeVertex;
export const TreeEdge = go.TreeEdge;
export const version = go.version;
